The UCREL Tool Chain API class:
ucrel_api = UCREL_API('a.moore@lancaster.ac.uk', 'http://ucrel-api.lancaster.ac.uk')
ucrel_api
ucrel_doc = ucrel_api.usas(('Hope you have a nice day. '
'Works with SGML entities e.g. 5 > 4.'
'Also with MWE like New York.'))
for index, sentence in enumerate(ucrel_doc.sentences):
print(f'Sentence {index}')
for token in sentence:
print(token)
if index == 0 or index == 1:
print('\n')
Note that even though New York
is the first MWE
identified as shown above, it has the MWE tag
: 2.2.1
and 2.2.2
suggesting that there has been a MWE previously due to the first number in the tag being 2
. Actually the USAS, POS, and MWE tags shown above are the most likely tags and other less probable tags are generated for each token, but they are not shown here as we only output the most probable tag for each token.