@@ -244,3 +244,49 @@ def test_iterable_type_for_all_lemma_names(self):
244244        self .assertTrue (hasattr (cat_lemmas , "__iter__" ))
245245        self .assertTrue (hasattr (cat_lemmas , "__next__" ) or  hasattr (eng_lemmas , "next" ))
246246        self .assertTrue (cat_lemmas .__iter__ () is  cat_lemmas )
247+ 
248+     def  test_en_ptb_tags (self ):
249+         # Common PTB tags (mapped in both PTB and Brown) 
250+         self .assertEqual (wn .tag2pos ("NN" ), "n" )  # noun 
251+         self .assertEqual (wn .tag2pos ("VB" ), "v" )  # verb 
252+         self .assertEqual (wn .tag2pos ("JJ" ), "a" )  # adjective 
253+         self .assertEqual (wn .tag2pos ("RB" ), "r" )  # adverb 
254+ 
255+         # PTB-specific tags (mapped in PTB, not in Brown) 
256+         self .assertEqual (wn .tag2pos ("NNS" ), "n" )  # plural noun (PTB only) 
257+         self .assertEqual (wn .tag2pos ("VBD" ), "v" )  # verb, past tense (PTB only) 
258+         self .assertEqual (
259+             wn .tag2pos ("VBG" ), "v" 
260+         )  # verb, gerund/present participle (PTB only) 
261+         self .assertEqual (wn .tag2pos ("JJR" ), "a" )  # adjective, comparative (PTB only) 
262+         self .assertEqual (wn .tag2pos ("RBR" ), "r" )  # adverb, comparative (PTB only) 
263+ 
264+         # Tags that should yield None (not mapped in WordNet) 
265+         self .assertIsNone (wn .tag2pos ("PRP" ))
266+         self .assertIsNone (wn .tag2pos ("WP" ))
267+         self .assertIsNone (wn .tag2pos ("TO" ))
268+         self .assertIsNone (wn .tag2pos ("PRT" ))
269+         self .assertIsNone (wn .tag2pos ("POS" ))
270+         self .assertIsNone (wn .tag2pos ("." ))
271+ 
272+     def  test_en_brown_tags (self ):
273+         # Common Brown tags (mapped in both PTB and Brown) 
274+         self .assertEqual (wn .tag2pos ("NN" , tagset = "en-brown" ), "n" )  # noun 
275+         self .assertEqual (wn .tag2pos ("VB" , tagset = "en-brown" ), "v" )  # verb 
276+         self .assertEqual (wn .tag2pos ("JJ" , tagset = "en-brown" ), "a" )  # adjective 
277+         self .assertEqual (wn .tag2pos ("RB" , tagset = "en-brown" ), "r" )  # adverb 
278+ 
279+         # Brown-specific tags (mapped in Brown, not in PTB) 
280+         self .assertEqual (
281+             wn .tag2pos ("HV" , tagset = "en-brown" ), "v" 
282+         )  # 'have' auxiliary (Brown only) 
283+         self .assertEqual (
284+             wn .tag2pos ("BEZ" , tagset = "en-brown" ), "v" 
285+         )  # 'be' auxiliary, 3rd person singular present (Brown only) 
286+         self .assertEqual (
287+             wn .tag2pos ("DOZ" , tagset = "en-brown" ), "v" 
288+         )  # 'do' auxiliary, 3rd person singular present (Brown only) 
289+ 
290+         # Tags that should yield None (not mapped in WordNet) 
291+         self .assertIsNone (wn .tag2pos ("PPL" , tagset = "en-brown" ))
292+         self .assertIsNone (wn .tag2pos ("(" , tagset = "en-brown" ))
0 commit comments