danielhers / tupa

Transition-based UCCA Parser
https://danielhers.github.io/tupa
GNU General Public License v3.0
72 stars 24 forks source link

How to parse multiple of text files in one time? #70

Closed CarolLi closed 5 years ago

CarolLi commented 5 years ago

The parser runs very slow using python -m tupa example.txt -m <model_filename> . I think the reason is that the model ucca-bilstm needs to be loaded every time the command runs, and I have lots of files. Therefore, is there a way that I could parse all my text files once the model loaded?

danielhers commented 5 years ago

Sure, you can pass as many text files as you like, or a directory of text files, or a glob pattern.

CarolLi commented 5 years ago

Sure, you can pass as many text files as you like, or a directory of text files, or a glob pattern.

I think I know how to do, thank you. I may can deal with command like this python -m tupa directory_of_text_files/*.txt -m <model_filename>.

danielhers commented 5 years ago

If you want to parse example1.txt, example2.txt and example3.txt, use this command:

python -m tupa example1.txt example2.txt example3.txt -m <model_filename>

Alternatively, you can run:

python -m tupa example*.txt -m <model_filename>

Or if you have a directory example_dir with text files in it, run:

python -m tupa example_dir -m <model_filename>

Let me know if you have any more questions.

CarolLi commented 5 years ago

If you want to parse example1.txt, example2.txt and example3.txt, use this command:

python -m tupa example1.txt example2.txt example3.txt -m <model_filename>

Alternatively, you can run:

python -m tupa example*.txt -m <model_filename>

Or if you have a directory example_dir with text files in it, run:

python -m tupa example_dir -m <model_filename>

Let me know if you have any more questions.

Thank you! Another question about batch processing has raised just now. If I have multiple directories of examples, how can I do the parsing at once?

danielhers commented 5 years ago

Same idea:

python -m tupa example_dir1 example_dir2 -m <model_filename>
CarolLi commented 5 years ago

Same idea:

python -m tupa example_dir1 example_dir2 -m <model_filename>

Thank you very much!