Skip to content

Commit

Permalink
Disallow only one alphabet character
Browse files Browse the repository at this point in the history
  • Loading branch information
dtan4 committed Jun 2, 2014
1 parent 1aac576 commit 9620522
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/hiraoyogi/analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def analyze_text(text)

def disallowed_word?(line)
DISALLOW_TYPE.include?(type(line.feature)) || line.surface.nil? ||
line.surface.length <= 1 || /\A\$/ =~ line.surface
/\A[a-zA-Z0-9]\z/ =~ line.surface || /\A\$/ =~ line.surface
end

def type(feature)
Expand Down
4 changes: 2 additions & 2 deletions spec/hiraoyogi/analyzer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ module Hiraoyogi
end

let(:text) do
"すもももももももものうち a $$"
"すもももももももものうち a $$"
end

describe "#analyze_text" do
it "should create index table" do
result = analyzer.analyze_text(text)
expect(result).to include "すもも" => 1, "もも" => 2, "うち" => 1
expect(result).to include "すもも" => 1, "もも" => 2, "うち" => 1, "私" => 1
expect(result).not_to include "a" => 1
expect(result).not_to include "$$" => 1
end
Expand Down

0 comments on commit 9620522

Please sign in to comment.