예제 #1
0
파일: ulcli.py 프로젝트: ghabxph/ulcli
    def __init__(self, _lang):
        """
        Class constructor

        :param _lang: Language to use

        Note: Currently, we only support english this time. I will post a guide how to
              modify language of this program
        """
        # Sets the default language
        self.__lang = lang.init(_lang)

        # Initializes description
        self.__description = self.__description % self.__lang.ulcli_description
예제 #2
0
import wordmapOp
import networkOp
import help
import lang
import training

lang.init("D:/NLP/paper1/stopWordList(gen).txt","D:/NLP/paper1/synonymsList(gen).txt")
txt=help.readTXT("D:/NLP/paper1/123.txt")
tsenllist=txt.split("\n")
print("载入词典与读取训练文本完成!")

# 训练部分:
# sen是句子,senlist是篇章,senllist是所有训练篇章。一开始有文本形式的数组tsenllist,元素为文本形式的tsenlist
senllist=[]
for tsenlist in tsenllist:
    senlistsou = lang.segWord(tsenlist)
    senlist = help.splitList(senlistsou,"。")
    del senlist[len(senlist) - 1] #去除尾部空列
    senllist.append(senlist)
print("切割训练文本完成!")

wordmap=[]
for senlist in senllist:
    for sen in senlist:
        wordmapOp.genWordMap(wordmap,sen)
print("wordmap生成完成!")
wordmapOp.normalizedWeight(wordmap,senllist)
print("wordmap归一化完成!")

allpnode=[]
network=[]
예제 #3
0
def _test_init(monkeypatch, capsys):
    c = MockContext()
    lang.init(c, 'proj', 'lang')
    lang.init(c, 'proj', '.', check=True)
예제 #4
0
파일: spacegame.py 프로젝트: 602p/spacegame
root.screen = scrollingscreen

serialize.init(root)
ship.init(root)
item.init(root)
primitives.init(root)
tasks.init(root)
ai.init(root)
ui_states.init(root)
sectors.init(root)
newgame.init(root)
dialog.init(root)
quests.init(root)
eb.init_grufs(root)
faction.init(root)
lang.init()

import music
music.init()

root.gfxcursor = gfxcursor.GfxCursor(root, root.screen.screen)

root.particlemanager = particles.ParticleManager()

root.state_manager = state.StateManager(root)
root.console = pyconsole.Console(screen.image, (0, 0, 1300, 200),
                                 localsx=locals())

root.igconsole = overlay_gui.IngameRenderedConsole(root, 5)
root.igconsole.enable_debug()