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

ArgumentError: missing keyword: text #4

Open
nardonykolyszyn opened this issue Jun 18, 2019 · 1 comment · May be fixed by #5
Open

ArgumentError: missing keyword: text #4

nardonykolyszyn opened this issue Jun 18, 2019 · 1 comment · May be fixed by #5

Comments

@nardonykolyszyn
Copy link

Rails: 5.1.7
Ruby: 2.5.2

text = "This string has a date: Monday, November 3rd, 2011. I was thinking... it also shouldn't have too many contractions, maybe 4. <html> Some HTML and a hyphenated-word</html>. Don't count stray punctuation ? ? ? Please visit the ____________ ------------ ........ go-to site: https://www.example-site.com today. Let's add a list 1. item a 2. item b 3. item c. Now let's add he/she/it or a c:\\Users\\john. 2/15/2012 is the date! { HYPERLINK 'http://www.hello.com' }"
WordCountAnalyzer::Analyzer.new.analyze(text)
from /home/devpolish/.rbenv/versions/2.5.2/lib/ruby/gems/2.5.0/gems/word_count_analyzer-1.0.1/lib/word_count_analyzer/analyzer.rb:4:in `initialize'
@drusepth
Copy link

drusepth commented Jul 1, 2021

This looks like a mistake in the documentation. If you take a look at the Analyzer#analyze source, it looks like you're supposed to pass the text into the Analyzer instance at initialization-time and then call .analyze.

irb(main):014:0> text = "This string has a date: Monday, November 3rd, 2011. I was thinking... it also shouldn't have too many contractions, maybe 4. <html> Some HTML and a hyphenated-word</html>. Don't count stray punctuation ? ? ? Please visit the ____________ ------------ ........ go-to site: https://www.example-site.com today. Let's add a list 1. item a 2. item b 3. item c. Now let's add he/she/it or a c:\\Users\\john. 2/15/2012 is the date! { HYPERLINK 'http://www.hello.com' }"

irb(main):015:0> WordCountAnalyzer::Analyzer.new(text: text).analyze
=> {"ellipsis"=>1, "hyperlink"=>2, "contraction"=>4, "hyphenated_word"=>2, "date"=>2, "number"=>5, "numbered_list"=>4, "xhtml"=>1, "forward_slash"=>1, "backslash"=>1, "dotted_line"=>1, "dashed_line"=>1, "underscore"=>1, "stray_punctuation"=>5}

@drusepth drusepth linked a pull request Jul 1, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants