Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed testing and added support to use CPOS/UPOS for parsing. #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

liisaratsep
Copy link

There were inconsitencies with variable names, 'tespath' was used in some places and 'testpath' in others and thus testing didn't work. Fixed that.

Also, added a new command line flag --cpos. When turned on, it will use CPOS (or UPOS for CoNLL-U) part-of-speech tags for parsing instead of POS (XPOS) tags. This is useful for CoNLL-U in particular, where the language-specific XPOS tags are very narrow and often express morphological features as well. With really specific POS tags, the parser can end up with POS keyerrors such as the one from UD_Arabic[1] below:

Traceback (most recent call last):
  File "src/parser.py", line 59, in <module>
    utils.write_conll(devpath, parser.Predict(options.conll_dev))
  File "/mnt/c/Users/Liisa/Documents/ATI/NMT/bist-parser/barchybrid/src/utils.py", line 119, in write_conll
    for sentence in conll_gen:
  File "/mnt/c/Users/Liisa/Documents/ATI/NMT/bist-parser/barchybrid/src/arc_hybrid.py", line 232, in Predict
    self.getWordEmbeddings(conll_sentence, False)
  File "/mnt/c/Users/Liisa/Documents/ATI/NMT/bist-parser/barchybrid/src/arc_hybrid.py", line 179, in getWordEmbeddings
    root.posvec = self.plookup[int(self.pos[root.pos])] if self.pdims > 0 else None
KeyError: 'QC-----S1R'

But UPOS tags are universal, so such errors are less likely to occur with this flag.

[1] https://github.com/UniversalDependencies/UD_Arabic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant