engtagger 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Rakefile +5 -0
- data/engtagger.gemspec +1 -1
- data/lib/engtagger/version.rb +1 -1
- data/lib/engtagger.rb +10 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 61101478ee5332b3ba91df6598db0e4822832be62edaf5ac8613256d8ba8d7d4
|
|
4
|
+
data.tar.gz: 903c665fd059b5095f2f240c2522f2a593d92bbf8cb500b142f6af373d48802c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 066d0510e7a585c38273a4fb28f33e05f9eb6f64a340b22ca3a6e05e8946866b769dc1966fc729f5351d16a318e6f6d2c41f4929a2bc627ad9d384654ba3a85f
|
|
7
|
+
data.tar.gz: d19da0ed3236dcc64963cb64fe5a7833b3c3790433c9b4dee06c87e2abb2cdf30733cdf55a6b9409396096c0f95e383d47a8cd168f7fda954874c544646227d8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.6 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
- Fix `get_noun_phrases`, `get_words` and `add_tags` taking time quadratic in
|
|
6
|
+
the input length on long runs of nouns and on long texts. Output is
|
|
7
|
+
unchanged. Upgrade if you tag text from untrusted sources.
|
|
8
|
+
|
|
3
9
|
## 0.4.5 (2026-08-14)
|
|
4
10
|
|
|
5
11
|
License metadata correction; no code changes. This library is a port (2009) of
|
data/Rakefile
CHANGED
|
@@ -18,3 +18,8 @@ task :normalize_permissions do
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
Rake::Task["build"].enhance([:normalize_permissions])
|
|
21
|
+
|
|
22
|
+
# Pre-release gate: after building, open the .gem and verify its payload
|
|
23
|
+
# against spec.files in both directions, then scan names, contents and modes.
|
|
24
|
+
# `rake release` depends on `build`, so a FAIL here stops the push.
|
|
25
|
+
Rake::Task["build"].enhance { sh "ruby", "scripts/verify_gem.rb" }
|
data/engtagger.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
|
11
11
|
gem.license = "GPL-3.0-only"
|
|
12
12
|
gem.required_ruby_version = Gem::Requirement.new(">= 2.6")
|
|
13
13
|
gem.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
14
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|tools|docs)/}) }
|
|
14
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|tools|docs|scripts)/}) }
|
|
15
15
|
end
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
|
17
17
|
gem.name = "engtagger"
|
data/lib/engtagger/version.rb
CHANGED
data/lib/engtagger.rb
CHANGED
|
@@ -545,23 +545,27 @@ class EngTagger
|
|
|
545
545
|
|
|
546
546
|
found = Hash.new(0)
|
|
547
547
|
phrase_ext = /(?:#{PREP}|#{DET}|#{NUM})+/xo
|
|
548
|
+
noun = /#{NN}/o
|
|
549
|
+
longest = @conf[:longest_noun_phrase]
|
|
548
550
|
scanned = tagged.scan(@@mnp)
|
|
549
551
|
# Find MNPs in the text, one sentence at a time
|
|
550
552
|
# Record and split if the phrase is extended by a (?:PREP|DET|NUM)
|
|
551
553
|
mn_phrases = []
|
|
552
554
|
scanned.each do |m|
|
|
553
555
|
found[m] += 1 if phrase_ext =~ m
|
|
554
|
-
mn_phrases
|
|
556
|
+
mn_phrases.concat(m.split(phrase_ext))
|
|
555
557
|
end
|
|
556
558
|
mn_phrases.each do |mnp|
|
|
557
559
|
# Split the phrase into an array of words, and create a loop for each word,
|
|
558
560
|
# shortening the phrase by removing the word in the first position.
|
|
559
561
|
# Record the phrase and any single nouns that are found
|
|
560
562
|
words = mnp.split
|
|
561
|
-
words.
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
563
|
+
words.each_index do |i|
|
|
564
|
+
# Longer phrases would be dropped by the length limit below, so they
|
|
565
|
+
# are not built in the first place.
|
|
566
|
+
length = words.length - i
|
|
567
|
+
found[words[i..].join(" ")] += 1 if length > 1 && length <= longest
|
|
568
|
+
found[words[i]] += 1 if noun.match?(words[i])
|
|
565
569
|
end
|
|
566
570
|
end
|
|
567
571
|
ret = Hash.new(0)
|
|
@@ -677,7 +681,7 @@ class EngTagger
|
|
|
677
681
|
tokenized = []
|
|
678
682
|
# Tokenize the text (splitting on punctuation as you go)
|
|
679
683
|
cleaned_text.split(/\s+/).each do |line|
|
|
680
|
-
tokenized
|
|
684
|
+
tokenized.concat(split_punct(line))
|
|
681
685
|
end
|
|
682
686
|
split_sentences(tokenized)
|
|
683
687
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: engtagger
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yoichiro Hasebe
|
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
82
|
requirements: []
|
|
83
|
-
rubygems_version:
|
|
83
|
+
rubygems_version: 4.0.24
|
|
84
84
|
specification_version: 4
|
|
85
85
|
summary: A probability based, corpus-trained English POS tagger
|
|
86
86
|
test_files: []
|