Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
2f9c64e8
Commit
2f9c64e8
authored
Apr 09, 2013
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #361 and #362
parent
64fe2c13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
annotator.js
h/lib/annotator.js
+3
-3
dom_text_matcher.coffee
h/lib/dom_text_matcher.coffee
+9
-3
No files found.
h/lib/annotator.js
View file @
2f9c64e8
...
...
@@ -6,7 +6,7 @@
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-0
3-19 03:37:5
6Z
** Built at: 2013-0
4-09 22:10:4
6Z
*/
(
function
()
{
...
...
@@ -963,7 +963,7 @@
};
result
=
this
.
domMatcher
.
searchFuzzyWithContext
(
prefix
,
suffix
,
quote
,
expectedStart
,
expectedEnd
,
false
,
null
,
options
);
if
(
!
result
.
matches
.
length
)
{
console
.
log
(
"Fuzzy matching did not return any results. Giving up."
);
console
.
log
(
"Fuzzy matching did not return any results. Giving up
on two-phase strategy
."
);
return
null
;
}
match
=
result
.
matches
[
0
];
...
...
@@ -994,7 +994,7 @@
};
result
=
this
.
domMatcher
.
searchFuzzy
(
quote
,
expectedStart
,
false
,
null
,
options
);
if
(
!
result
.
matches
.
length
)
{
console
.
log
(
"Fuzzy matching did not return any results. Giving up."
);
console
.
log
(
"Fuzzy matching did not return any results. Giving up
on one-phase strategy
."
);
return
null
;
}
match
=
result
.
matches
[
0
];
...
...
h/lib/dom_text_matcher.coffee
View file @
2f9c64e8
...
...
@@ -197,6 +197,8 @@ class window.DomTextMatcher
analysis
.
exact
or
# "Found text matches exactly to pattern"
(
analysis
.
comparison
.
errorLevel
<=
matchThreshold
)
# still acceptable
mappings
=
@
mapper
.
getMappingsForCharRange
prefixEnd
,
suffixStart
# Collect the results
match
=
{}
for
obj
in
[
charRange
,
analysis
,
mappings
]
for
k
,
v
of
obj
...
...
@@ -248,18 +250,22 @@ class window.DomTextMatcher
textMatches
=
matcher
.
search
@
mapper
.
corpus
,
pattern
,
pos
,
options
t2
=
@
timestamp
()
# Collect the mappings
matches
=
[]
for
textMatch
in
textMatches
do
(
textMatch
)
=>
# See how good a match we have
analysis
=
@
analyzeMatch
pattern
,
textMatch
,
fuzzyComparison
# Collect the mappings
mappings
=
@
mapper
.
getMappingsForCharRange
textMatch
.
start
,
textMatch
.
end
# Collect the results
match
=
{}
for
obj
in
[
charRange
,
analysis
,
mappings
]
for
obj
in
[
textMatch
,
analysis
,
mappings
]
for
k
,
v
of
obj
match
[
k
]
=
v
matches
.
push
match
null
t3
=
@
timestamp
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment