Parse input from stdin. This is a simple wrapper for mecab-python3 so you can test it from the command line. Like the mecab binary, it treats each line of stdin as one sentence. You can pass tagger arguments here too.
()
| 4 | |
| 5 | |
| 6 | def parse(): |
| 7 | """Parse input from stdin. |
| 8 | |
| 9 | This is a simple wrapper for mecab-python3 so you can test it from the |
| 10 | command line. Like the mecab binary, it treats each line of stdin as one |
| 11 | sentence. You can pass tagger arguments here too. |
| 12 | """ |
| 13 | |
| 14 | args = ' '.join(sys.argv[1:]) |
| 15 | tagger = Tagger(args) |
| 16 | |
| 17 | for line in fileinput.input([]): |
| 18 | # strip the newline on output |
| 19 | print(tagger.parse(line.strip())[:-1]) |
| 20 | |
| 21 | |
| 22 | def info(): |