Beispiel #1
0
 def test_get_signs_for_word(self):
     """
     Tries getting a sign from the grammar from an example of 
     chord input.
     
     @see: L{jazzparser.grammar.Grammar.get_signs_for_word}
     
     """
     g = Grammar()
     # Try a few words
     for word in self.dbinput.chords[:10]:
         # This should be a list of signs
         signs = g.get_signs_for_word(word)
Beispiel #2
0
 def test_tag_to_function(self):
     """
     Try getting a function for every tag and check it's in the 
     set of allowed functions.
     
     """
     g = Grammar()
     for tag in g.pos_tags:
         fun = g.tag_to_function(tag)
         if fun is None:
             warnings.warn("Tag %s has no function given by the "\
                 "grammar" % tag)
         else:
             self.assertIn(fun, ['T','D','S','Pass'])
Beispiel #3
0
 def test_get_sign_for_word_by_tag(self):
     """
     @see: L{jazzparser.grammar.Grammar.get_sign_for_word_by_tag}
     
     """
     g = Grammar()
     # Get the list of allowed tags
     tags = g.pos_tags
     # Try a few words
     for chord in self.dbinput.chords[:10]:
         # Try a few tags for each
         for tag in tags[:6]:
             # Should get a sign or None
             sign = g.get_sign_for_word_by_tag(chord, tag)