Beispiel #1
0
def instance(review):                     # "Great book!"
    # [("Great", "JJ"), ("book", "NN"), ("!", "!")]
    v = tag(review)
    v = [word for (word, pos) in v if pos in ("JJ", "RB") or word in ("!")]
    v = [predicative(word) for word in v]  # ["great", "!", "!"]
    v = count(v)                          # {"great": 1, "!": 1}
    return v
Beispiel #2
0
def instance(review):  # "Great book!"
    # [("Great", "JJ"), ("book", "NN"), ("!", "!")]
    v = tag(review)
    v = [word for (word, pos) in v if pos in ("JJ", "RB") or word in ("!")]
    v = [predicative(word) for word in v]  # ["great", "!", "!"]
    v = count(v)  # {"great": 1, "!": 1}
    return v
Beispiel #3
0
 def test_tag(self):
     # Assert [("zwarte", "JJ"), ("panters", "NNS")].
     v = nl.tag("zwarte panters")
     self.assertEqual(v, [("zwarte", "JJ"), ("panters", "NNS")])
     print("pattern.nl.tag()")
Beispiel #4
0
 def test_tag(self):
     # Assert [("zwarte", "JJ"), ("panters", "NNS")].
     v = nl.tag("zwarte panters")
     self.assertEqual(v, [("zwarte", "JJ"), ("panters", "NNS")])
     print("pattern.nl.tag()")