コード例 #1
0
def initializeLanguagePairObjets(alignDictEnDe, alignDictFrDe, alignDictFourthDe, enWordDict, enBigramDict, deWordDict, deBigramDict,\
                                frWordDict, frBigramDict, fourthWordDict, fourthBigramDict, numClusInit, typeClusInit,\
                                edgeThresh1, edgeThresh2, edgeThresh3):
    
    # lang2 (de) is the common language between the two pairs
    lang1 = Language(enWordDict, enBigramDict, numClusInit, typeClusInit)
    lang2 = Language(deWordDict, deBigramDict, numClusInit, typeClusInit)
    lang3 = Language(frWordDict, frBigramDict, numClusInit, typeClusInit)
    lang4 = Language(fourthWordDict, fourthBigramDict, numClusInit, typeClusInit)
    
    # En-De
    common12 = CommonInLangPair(alignDictEnDe, lang1, lang2, edgeThresh1)
    lang12 = LanguagePairForward(lang1, lang2, common12)
    lang21 = LanguagePairBackward(lang2, lang1, common12)
    lang12.assignReverseLanguagePair(lang21)
    lang21.assignReverseLanguagePair(lang12)
    
    # Fr-De
    common32 = CommonInLangPair(alignDictFrDe, lang3, lang2, edgeThresh2)
    lang32 = LanguagePairForward(lang3, lang2, common32)
    lang23 = LanguagePairBackward(lang2, lang3, common32)
    lang32.assignReverseLanguagePair(lang23)
    lang23.assignReverseLanguagePair(lang32)
    
    # 4-2
    common42 = CommonInLangPair(alignDictFourthDe, lang4, lang2, edgeThresh3)
    lang42 = LanguagePairForward(lang4, lang2, common42)
    lang24 = LanguagePairBackward(lang2, lang4, common42)
    lang42.assignReverseLanguagePair(lang24)
    lang24.assignReverseLanguagePair(lang42)
    
    return lang1, lang2, lang3, lang4, lang12, lang21, lang32, lang23, lang42, lang24
コード例 #2
0
def initializeLanguagePairObjets(alignDict, enWordDict, enBigramDict, frWordDict, frBigramDict, numClusInit, typeClusInit, edgeThresh):
    
    lang1 = Language(enWordDict, enBigramDict, numClusInit, typeClusInit)
    lang2 = Language(frWordDict, frBigramDict, numClusInit, typeClusInit)
    common = CommonInLangPair(alignDict, lang1, lang2, edgeThresh)
    lang12 = LanguagePairForward(lang1, lang2, common)
    lang21 = LanguagePairBackward(lang2, lang1, common)
    lang12.assignReverseLanguagePair(lang21)
    lang21.assignReverseLanguagePair(lang12)
    
    return lang1, lang2, lang12, lang21
コード例 #3
0
def initializeLanguagePairObjets(alignDictEnDe, alignDictFrDe, enWordDict, enBigramDict, deWordDict, deBigramDict,\
                                frWordDict, frBigramDict, numClusInit, typeClusInit, edgeThresh1, edgeThresh2):

    # lang3 (de) is the common language between the two pairs
    lang1 = Language(enWordDict, enBigramDict, numClusInit, typeClusInit)
    lang2 = Language(deWordDict, deBigramDict, numClusInit, typeClusInit)
    lang3 = Language(frWordDict, frBigramDict, numClusInit, typeClusInit)

    # En-De
    common12 = CommonInLangPair(alignDictEnDe, lang1, lang2, edgeThresh1)
    lang12 = LanguagePairForward(lang1, lang2, common12)
    lang21 = LanguagePairBackward(lang2, lang1, common12)
    lang12.assignReverseLanguagePair(lang21)
    lang21.assignReverseLanguagePair(lang12)

    # Fr-De
    common32 = CommonInLangPair(alignDictFrDe, lang3, lang2, edgeThresh2)
    lang32 = LanguagePairForward(lang3, lang2, common32)
    lang23 = LanguagePairBackward(lang2, lang3, common32)
    lang32.assignReverseLanguagePair(lang23)
    lang23.assignReverseLanguagePair(lang32)

    return lang1, lang2, lang3, lang12, lang21, lang32, lang23
コード例 #4
0
def initializeLanguagePairObjets(alignDictEnDe, alignDictFrDe, alignDictFourthDe, alignDictFifthDe, enWordDict, enBigramDict, deWordDict, deBigramDict,\
                                frWordDict, frBigramDict, fourthWordDict, fourthBigramDict, fifthWordDict, fifthBigramDict, numClusInit, typeClusInit,\
                                edgeThresh1, edgeThresh2, edgeThresh3, edgeThresh4):

    # lang2 (de) is the common language between the two pairs
    lang1 = Language(enWordDict, enBigramDict, numClusInit, typeClusInit)
    lang2 = Language(deWordDict, deBigramDict, numClusInit, typeClusInit)
    lang3 = Language(frWordDict, frBigramDict, numClusInit, typeClusInit)
    lang4 = Language(fourthWordDict, fourthBigramDict, numClusInit,
                     typeClusInit)
    lang5 = Language(fifthWordDict, fifthBigramDict, numClusInit, typeClusInit)

    # En-De
    common12 = CommonInLangPair(alignDictEnDe, lang1, lang2, edgeThresh1)
    lang12 = LanguagePairForward(lang1, lang2, common12)
    lang21 = LanguagePairBackward(lang2, lang1, common12)
    lang12.assignReverseLanguagePair(lang21)
    lang21.assignReverseLanguagePair(lang12)

    # Fr-De
    common32 = CommonInLangPair(alignDictFrDe, lang3, lang2, edgeThresh2)
    lang32 = LanguagePairForward(lang3, lang2, common32)
    lang23 = LanguagePairBackward(lang2, lang3, common32)
    lang32.assignReverseLanguagePair(lang23)
    lang23.assignReverseLanguagePair(lang32)

    # 4-2
    common42 = CommonInLangPair(alignDictFourthDe, lang4, lang2, edgeThresh3)
    lang42 = LanguagePairForward(lang4, lang2, common42)
    lang24 = LanguagePairBackward(lang2, lang4, common42)
    lang42.assignReverseLanguagePair(lang24)
    lang24.assignReverseLanguagePair(lang42)

    # 5-2
    common52 = CommonInLangPair(alignDictFifthDe, lang5, lang2, edgeThresh4)
    lang52 = LanguagePairForward(lang5, lang2, common52)
    lang25 = LanguagePairBackward(lang2, lang5, common52)
    lang52.assignReverseLanguagePair(lang25)
    lang25.assignReverseLanguagePair(lang52)

    return lang1, lang2, lang3, lang4, lang5, lang12, lang21, lang32, lang23, lang42, lang24, lang52, lang25