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

Instructions for using on the command line #43

Open
ftyers opened this issue Jul 14, 2018 · 1 comment
Open

Instructions for using on the command line #43

ftyers opened this issue Jul 14, 2018 · 1 comment

Comments

@ftyers
Copy link

ftyers commented Jul 14, 2018

Would it be possible to get instructions for how to use this on the command line in a pipe? e.g.

$ cat ~/corpora/languages/tatar/wikipedia/wiki.txt |  ruby pragmatic_segmenter.rb 

This gives no output...

@ftyers
Copy link
Author

ftyers commented Jul 14, 2018

This is kind of what I'd like, but probably someone who actually knows Ruby can make a better/more robust version. :)

$ cat segment.rb 

require 'pragmatic_segmenter'

lang = "en"
if ARGV[0]
    lang=ARGV[0]
end

STDIN.each_with_index do |line, idx|
    ps = PragmaticSegmenter::Segmenter.new(text: line, language: lang)
    ps.segment
    for i in ps.segment
        print(i,"\n")
    end
end

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

No branches or pull requests

1 participant