MCPcopy Create free account
hub / github.com/EasyIME/PIME / sortByPhrase

Method sortByPhrase

python/cinbase/__init__.py:2772–2792  ·  view source on GitHub ↗
(self, cbTS, candidates)

Source from the content-addressed store, hash-verified

2770 return charStr
2771
2772 def sortByPhrase(self, cbTS, candidates):
2773 sortbyphraselist = []
2774 if cbTS.userphrase.isInCharDef(cbTS.lastCommitString):
2775 sortbyphraselist = cbTS.userphrase.getCharDef(cbTS.lastCommitString)
2776 if PhraseData.phrase.isInCharDef(cbTS.lastCommitString):
2777 if len(sortbyphraselist) == 0:
2778 sortbyphraselist = PhraseData.phrase.getCharDef(cbTS.lastCommitString)
2779 else:
2780 plist = PhraseData.phrase.getCharDef(cbTS.lastCommitString)
2781 for pstr in plist:
2782 if not pstr in sortbyphraselist:
2783 sortbyphraselist.append(pstr)
2784
2785 i = 0
2786 if len(sortbyphraselist) > 0:
2787 for pStr in sortbyphraselist:
2788 if pStr in candidates:
2789 candidates.remove(pStr)
2790 candidates.insert(i, pStr)
2791 i += 1
2792 return candidates
2793
2794 # List 分段
2795 def chunks(self, l, n):

Callers 1

onKeyDownMethod · 0.95

Calls 3

isInCharDefMethod · 0.45
getCharDefMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected