clause_extractor 0.1.3 → 0.1.4
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.
- data/lib/matchers.rb +68 -0
- metadata +2 -1
data/lib/matchers.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
pronouns = "(i|you|he|she|it|they|we|there)"
|
3
|
+
present_perfect = "(already|ever|for|just|never|since|yet)"
|
4
|
+
have_has = "(have|has|haven't|hasn't)"
|
5
|
+
was_were = "(were|was|wasn't|weren't)"
|
6
|
+
had = "([a-z]{1,4}'d|had)(n't)*"
|
7
|
+
have_has = "(have|has|haven't|hasn't|havent|hasnt|has not|have not)"
|
8
|
+
contractions = "(it'*s|he'*s|she'*s|[a-z]{1,4}'*ve)"
|
9
|
+
should = "should(n't)*"
|
10
|
+
to_be = "(am|are|'m|'re|'s|is|[a-z]{1,4}'re)"
|
11
|
+
will = "(will|won't|[a-z]{1,4}'ll)"
|
12
|
+
would = "(would(n't)*|[a-z]{1,4}'d)"
|
13
|
+
|
14
|
+
$tense_regexes = {
|
15
|
+
|
16
|
+
'third' => {
|
17
|
+
"simple present" => [
|
18
|
+
/\b(he|she|it)\s+search(s)?\b/i, #he arrives
|
19
|
+
/\bsearch(s)?\s+(it|them|him|her|me|you|us)\b/i #adapts it
|
20
|
+
]
|
21
|
+
},
|
22
|
+
'infinitive' => {
|
23
|
+
"simple present" => [/\b((I|you|they|we|to)\s+)*+search\b/i],#to arrive
|
24
|
+
|
25
|
+
"subjunctive future" => [
|
26
|
+
/\bif\s+#{pronouns}\s+#{was_were}\s+(not\s+)*to\s+(not\s+)*search/i, #if I were to arise
|
27
|
+
/\bif\s+#{pronouns}\s+#{should}\s+(not\s+)*search/i #If I should arise
|
28
|
+
],
|
29
|
+
"subjunctive present" => [ /\bthat\s+#{pronouns}\s+(not\s+)*search/i], #that we arrive
|
30
|
+
"conditional simple" => [ /\b(#{pronouns}\s+)*#{would}(\s+not)*\s+search/i], #I would arise, I wouldn't arise
|
31
|
+
"will-future" => [ /\b(#{pronouns}\s+)*#{will}(\s+not)*\s+search/i], #I'll arise
|
32
|
+
"going to-future" => [ /\b(#{pronouns}\s+)*#{to_be}\s+(not\s+)*going\s+to\s+search/i], #they are going to cry
|
33
|
+
},
|
34
|
+
'gerund' => {
|
35
|
+
"conditional perfect progressive" => [ /\b(#{pronouns}\s+)*#{would}\s+(not\s+)*have\s+(not\s+)*been\s+search/i], #I would have been searching
|
36
|
+
"present perfect progressive" => [
|
37
|
+
/\b(#{have_has}\s+)(#{pronouns}\s+)*(not\s+)*(#{present_perfect}\s+)*been\s+search/i, #have they not been searching
|
38
|
+
/\b(#{pronouns}\s+)*#{have_has}*\s+(not\s+)*(#{present_perfect}\s+)*been\s+search/i #I have been searching
|
39
|
+
],
|
40
|
+
"past perfect progressive" => [
|
41
|
+
/\b(#{pronouns}\s+)*#{had}\s(not\s+)*(#{present_perfect}\s+)*been\s+search/i, #I had been searching,
|
42
|
+
/\bhad(n't)*\s+(#{pronouns}\s+)*(not\s+)*(#{present_perfect}\s+)*been\s+search/i, #had he not been searching
|
43
|
+
],
|
44
|
+
"conditional progressive" => [/\b(#{pronouns}\s+)*#{would}\s+(not\s+)*be\s+search/i], #I would be searching (I'd)
|
45
|
+
"future progressive" => [
|
46
|
+
/\b((#{pronouns})\s+)*#{will}\s+(not\s+)*be\s+search/i,
|
47
|
+
/\b#{will}\s+(#{pronouns}\s+)(not\s+)*be\s+search/i,
|
48
|
+
], #I will be searching
|
49
|
+
"past progressive" => [/\b(#{pronouns}\s+)*#{was_were}*\s+(not\s+)*search/i], #I was searching
|
50
|
+
"present progressive" => [/\b(#{pronouns}\s*)*(#{to_be}\s+)*(not\s+)*search/i], #I'm rising
|
51
|
+
},
|
52
|
+
'past-participle' => {
|
53
|
+
"conditional perfect" => [/\b(#{pronouns}\s+)*#{would}\s+(not\s+)*have\s+(not\s+)*search/i], #I would not search
|
54
|
+
"future perfect" => [/\b(#{pronouns}\s+)*#{will}\s+have\s+search/i], #I'll have arisen
|
55
|
+
"past perfect" => [
|
56
|
+
/\b(#{pronouns}\s+)*#{had}\s+(not\s+)*((#{present_perfect})\s+)*search/i, #I had arisen
|
57
|
+
/\b#{had}\s+(#{pronouns}\s+)*(not\s+)*((#{present_perfect})\s+)*search/i
|
58
|
+
],
|
59
|
+
"present perfect" => [
|
60
|
+
/\b(#{pronouns}\s+)*#{have_has}\s+((#{present_perfect})\s+)*search/, #They have already seen
|
61
|
+
/\b#{have_has}\s+(#{pronouns}\s+)*(not\s+)*(#{present_perfect}\s+)*search/ #Have they already seen
|
62
|
+
],
|
63
|
+
"subjunctive past" => [/\bif\s+#{pronouns}\s+search/i], #if I arose
|
64
|
+
"simple past" => [/\b#{pronouns}\s+search/i] #you chose
|
65
|
+
},
|
66
|
+
#"present perfect" => [/^\s*search\b/i], #arisen
|
67
|
+
#"simple past" => [/^\s*search\b/i] #arose
|
68
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clause_extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- lib/clause_extractor.rb
|
21
21
|
- lib/conjugations.rb
|
22
|
+
- lib/matchers.rb
|
22
23
|
homepage: https://github.com/mikefab/clause_extractor
|
23
24
|
licenses: []
|
24
25
|
post_install_message:
|