-
Notifications
You must be signed in to change notification settings - Fork 0
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
Using custom model for input #2
Comments
Hi. I agree that making the use of external supertaggers easier is an important feature that should be implemented. As you may know, my parser requires probabilities of dependency structure in addition to those of supertags. Recently, I updated Python version of depccg (found at https://github.com/masashi-y/depccg. Sorry for the complicatedness...), so that it can accept input file in jsonl format where each line corresponds to a json dictionary containing infos about a sentence, that should look like as follow:
Optionally, you can omit Please try the following scripts and check the attached json file to see if it works. git clone https://github.com/masashi-y/depccg
cd depccg
git checkout refactor
python setup.py build_ext --inplace # or you can install by "python setup.py install"
sh bin/depccg_en download # install default tagger
cat test.json | sh bin/depccg_en --input-format json Please be careful to use log probabilities (e.g. log_softmax). The scale mismatch may cause unexpected bahavior of the parser. |
I tested the json file and it worked! Thank you so much! I just re-read your paper and some of your code (ja_lstm_parser_bi.py) and seem to have a better understanding now. You jointly trained for P_tag and P_dep terms using a biLSTM. I still have some questions though. How does the default dependency parser assign dependency probabilities if I don't include "heads" and "heads_shape" fields in the json file? I'm guessing it loads the pre-trained biLSTM and do a forward prop to obtain the P_dep terms? In that case, if I wanted to parse Chinese, I guess I would need to train my own model to get the P_dep terms? Alternatively, if I just assigned equal probabilities to each P_dep (say, set "heads" to [# words, #words+1] with all -1's) as a quick hack, would this be equivalent to using Mike Lewis's EasySRL parser? Also, why does "heads" have shape [# words, # words + 1]? I'm trying to parse the Chinese CCGBank, so I would highly appreciate your tips on any challenges you faced (Japanese is strictly head-final, no tri-training available, had to convert to bunsetsu dependency for evaluation...could you still use EASYCCG for Japanese evaluation?) or any reference that might be helpful (for example, how can I use the script for converting from CCGBank to dependency? Any code in this repo/python repo that I should look at more closely?). Sorry I have so many questions. I'm so glad there's someone working on Japanese CCG though. Thank you so much again for your help! |
I'm happy too, that you are working on Chinese CCG parsing!
Exactly yes. It loads pre-trained biLSTM trained using tri-training.
Ideally yes.
If you set P_dep in that way, it becomes very close to EasySRL. But it lacks a heuristic method that is introduced in Mike Lewis's paper (e.g. what he calls attach-low heuristics). So the performance will be poorer in the case of English parsing.
heads[i, 0] is a log probability that (i+1)'th word is connected to dummy root node in a dependency tree.
Regarding tri-training, I did not do it for Japanese language simply because I did not have enough time for that. You download some huge data (e.g. wikipedia) and assign supertags and dependency trees using some taggers and dep-parsers, which is just an engineering work. |
Thank you so much for your thorough explanations. Really appreciate your help! |
Hi. Sorry to reply late. Unfortunately there are some language-specific configurations. Most importantly, you must define a set of combinatory rules and a set of unary rules for a specific language. You can find the sets of combinatory rules implemented for Japanese and English languages at https://github.com/masashi-y/depccg.ml/blob/master/lib/grammar.ml, and you can find the sets of unary rules in the zipped model files (unary_rules.txt file). Additionaly, in the zip archive you can see other things such as seen_rules.txt and cat_dict.txt, which is used to reduce the search space in runnning A* algorithm. You should configure so that the parser does not use them, or it would be nice if you create one for Chinese language for the efficiency sake. |
I have trained a supertagger using BERT. It takes in a sentence and outputs a softmax for each word in the sentence.
I want to use your A* parsing method to parse the sentence. How can I use my trained supertagger and combine it with your A* parser? Thank you so much.
The text was updated successfully, but these errors were encountered: