Commits

Anonymous committed a0c9ded

[svn] update hanWordReport.py

  • Participants
  • Parent commits 2132264

Comments (0)

Files changed (2)

     return list(sharedSet)
 
 #----------------------------------------------------------------------------#
+def getChCommonOnly():
+    """ get common hanzi which not exist in common kanji
+    """
+    return set(getChCommonChar()) - set(getJpCommonChar())
+
+
+#----------------------------------------------------------------------------#
+def getJpCommonOnly():
+    """ get common kanji which not exist in common hanzi
+    """
+    return set(getJpCommonChar()) - set(getChCommonChar())
+
+
+#----------------------------------------------------------------------------#
 def getHanziCognateForKanji(kanjiSet):
     """ Get hanzi cognates for kanji set
     @param kanjiSet the kanji set to extract cognates

dict/hanWordReport.py

 import hanWord
 import util
 
-# word list
-chWord       = hanWord.getChHanWordList()
-jpWord       = hanWord.getJpHanWordList()
-
 # charset
 commHanzi        = hanChar.getChCommonChar()
 commKanji        = hanChar.getJpCommonChar()
 toplineHanzi     = hanChar.getReadableHanziTopline()
 toplineKanji     = hanChar.getReadableKanjiTopline()
 
+# word list
+chAllWord       = hanWord.getChHanWordList()
+jpAllWord       = hanWord.getJpHanWordList()
+
+# word filter flag
+commOnly = 1
+
+if commOnly:
+    chWord = hanWord.filterByCharset(chAllWord, commHanzi)
+    jpWord = hanWord.filterByCharset(jpAllWord, commKanji)
+else :
+    chWord = chAllWord
+    jpWord = jpAllWord
+
+
 #----------------------------------------------------------------------------#
 def percent(subList, allList):
     return '%d\t%.3f' % (len(subList), 1.0 * len(subList) / len(allList))