-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced iter_pairs() with itertools.product(). Added sentence thresh…
…olds. (#1)
- Loading branch information
1 parent
09b9b4b
commit d22f305
Showing
6 changed files
with
84 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from gigacluster.comparators import * | ||
from gigacluster.model import Doc, Token | ||
|
||
def test_overlap(): | ||
assert 1 == overlap(set('abc'), set('bca'))[-1] | ||
assert 0 == overlap(set('abc'), set('def'))[-1] | ||
assert 1/3 == overlap(set('ab'), set('bc'))[-1] | ||
|
||
def test_unigram_tf(): | ||
d = Doc() | ||
for i in 'The cat in the mat .'.split(): | ||
d.tokens.append(Token(raw=i)) | ||
tf = unigram_tf(d, slice(0, len(d.tokens) + 1)) | ||
assert {'cat': 1, 'mat': 1} == dict(tf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters