Created
April 9, 2012 06:29
-
-
Save benui-dev/2341946 to your computer and use it in GitHub Desktop.
Reading KNP data from a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Iterate through pre-parsed KNP output stored in a file. Useful for processing a batch of | |
| # sentences offline, and then dealing with them later. | |
| use strict; | |
| use warnings; | |
| use KNP::File; | |
| # File is the result of "juman | knp -tab > knp.out" | |
| my $knp_file = new KNP::File( file => $ARGV[0], encoding => 'utf-8' ) | |
| or die "Couldn't make KNP from file $!"; | |
| while (my $knp = $knp_file->each()) { | |
| # Normal KNP object in $knp | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment