示例#1
0
def run_tests():
    ok, err = 0, 0
    for path in basepaths:
        for root, dirs, files in os.walk(path):
            for afile in files:
                base, ext = os.path.splitext(afile)
                if ext in extensions:
                    try:
                        sample.main(os.path.join(root, afile))
                        ok += 1
                    except errors.AssimpError as error:
                        # assimp error is fine, this is a controlled case
                        print error
                        err += 1
    print '** Loaded %s models, got controlled errors for %s files' % (ok, err)
示例#2
0
def show_result(fn):
    cfg = TestObject()
    sample.main(cfg)
    LR_path = os.path.join(UPLOAD_FOLDER, fn)
    BICUBIC = get_bicubic(LR_path)
    copyfile(LR_path, os.path.join("./static", fn))
    SR = os.path.join(fn.replace("LR", "SR"))
    LR = os.path.join(fn)
    print(f"SR_PATH: {SR}")
    print(f"LR_PATH: {LR}")
    print(f"BICUBIC_PATH: {BICUBIC}")
    return render_template("result.html",
                           SR_name=SR,
                           LR_name=LR,
                           BICUBIC_name=BICUBIC)
示例#3
0
def run_tests():
	ok,err = 0,0
	for path in basepaths:
		for root, dirs, files in os.walk(path):
			for afile in files:
				base,ext = os.path.splitext(afile)	
				if ext in extensions:		
					try:
						sample.main(os.path.join(root,afile))
						ok += 1
					except errors.AssimpError as error:
						# assimp error is fine, this is a controlled case
						print error
						err += 1
	print '** Loaded %s models, got controlled errors for %s files' % (ok,err)
示例#4
0
def run():
    """
        begin of the test logic
    """
    try:
        #  random_search_test()
        import sample
        sample.main()
        pass
    except Exception as e:
        traceback.print_exc()
        stack = traceback.format_exc()
        logger.error(stack)
        report.report(False, "Game Test", e.message)
    finally:
        report._report_total()
        report.screenshot()
def get_caption(dis_url: str) -> str:
    
    extension = get_extension(dis_url)
    response = requests.get(dis_url)
    img = Image.open(BytesIO(response.content))
    
    img.save(f"./testImage.{extension}")

    return sample.main(f"./testImage.{extension}")
示例#6
0
def run_tests():
    ok, err = 0, 0
    for path in basepaths:
        print("Looking for models in %s..." % path)
        for root, dirs, files in os.walk(path):
            for afile in files:
                base, ext = os.path.splitext(afile)
                if ext in extensions:
                    try:
                        sample.main(os.path.join(root, afile))
                        ok += 1
                    except errors.AssimpError as error:
                        # Assimp error is fine; this is a controlled case.
                        print(error)
                        err += 1
                    except Exception:
                        print("Error encountered while loading <%s>"
                              % os.path.join(root, afile))
    print('** Loaded %s models, got controlled errors for %s files'
          % (ok, err))
示例#7
0
def run_tests():
    ok, err = 0, 0
    for path in basepaths:
        print("Looking for models in %s..." % path)
        for root, dirs, files in os.walk(path):
            for afile in files:
                base, ext = os.path.splitext(afile)
                if ext in extensions:
                    try:
                        sample.main(os.path.join(root, afile))
                        ok += 1
                    except errors.AssimpError as error:
                        # assimp error is fine, this is a controlled case
                        print error
                        err += 1
                    except Exception:
                        print("Error encountered while loading <%s>" %
                              os.path.join(root, afile))
    print('** Loaded %s models, got controlled errors for %s files' %
          (ok, err))
def test_main():
    global config
    # Tests to make sure the sample runs as expected

    try:
        config = sample.main(True, ['2,3', 'n'])
        checkData()

    except Exception as ex:
        print(f'Encountered Error: {ex}.')
        print
        traceback.print_exc()
        print
        success = False
        raise ex

    finally:
        print('Deletes')
        print

        suppressError(lambda: sendContainerDelete(omfHelper.getContainer()))
        suppressError(lambda: sendTypeDelete(omfHelper.getType()))
示例#9
0
import sample as smp
import generate_title as gnrt


def clear_tail(data, split_char=' ', tail_length=1):
    return split_char.join(data.split(split_char)[:-tail_length])


sample_txt = smp.main(gnrt.get_title(), 64, print_res=False)
final_txt = clear_tail(sample_txt, ':')
print(final_txt)
示例#10
0
        m = max(int(args.frac * args.num_users), 1)
        idxs_users = np.random.choice(range(args.num_users), m, replace=False)
        list_acc, list_loss = [], []
        global_model.eval()
        for idx in idxs_users:
            local_model = LocalUpdate(args=args,
                                      dataset=train_dataset,
                                      idxs=user_groups[idx],
                                      logger=logger)
            w, loss = local_model.update_weights(
                model=copy.deepcopy(global_model), global_round=epoch)
            acc = local_model.inference1(model=global_model)

            if x > 1:
                V2.load_state_dict(copy.deepcopy(w))
                w, my_sum1 = sample.main(global_model, V2,
                                         local_model.testloader)
                my_sum += my_sum1

            local_weights.append(copy.deepcopy(w))
            local_losses.append(copy.deepcopy(loss))
            list_acc.append(acc)

        test_accuracy.append(sum(list_acc) / len(list_acc))
        train_loss.append(sum(local_losses) / len(local_losses))

        global_weights = average_weights(local_weights)
        global_model.load_state_dict(global_weights)

    print(train_loss)
    print(test_accuracy)
    print(my_sum)
示例#11
0
# -*- coding: utf-8 -*-

import sample.main

def main():
	sample.main.main()

if __name__ == "__main__":
	main()
示例#12
0
def combinations(index, node_dict, dic, count, vruddhi, ends_with, two_vowels,
                 last_second, total, count_list):
    string = ""
    seeds_string = ""
    matched = []
    not_matched = []

    s_vow = ["a", "e", "i", "o", "u", "f", "U", "I"]
    l_vow = ["A", "E", "O", "F"]
    verbs = [
        'sUtra', 'rew', 'stag', 'stam', 'stan', 'stak', 'kzvel', 'vask',
        'hrIC', 'vasa', 'tuYj', 'vraRa', 'Kev', 'Gu', 'Gf', 'gUr', 'rOq',
        'sPuRq', 'tUl', 'Brez', 'BrAS', 'kuT', 'kuz', 'dviz', 'kuR', 'cezw',
        'SlaNg', 'sTUla', 'SlaNk', 'kuw', 'kus', 'kur', 'kup', 'gaRa', 'kuk',
        'gaRq', 'BrAj', 'kuq', 'kuc', 'cull', 'akz', 'glE', 'pawa', 'mev',
        'mep', 'jamB', 'med', 'Kol', 'Danv', 'Kor', 'zWiv', 'brU', 'mAh',
        'mAn', 'mA', 'tard', 'mI', 'Barts', 'tarj', 'kaYc', 'mlew', 'mlev',
        'me', 'mi', 'mf', 'hurC', 'Dor', 'Sarb', 'vazka', 'Kaz', 'Sarv', 'Kac',
        'hoq', 'saww', 'Kaq', 'Kaj', 'tIk', 'Kan', 'tIv', 'bund', 'Kad', 'lal',
        'SroR', 'laj', 'laq', 'lag', 'GuMz', 'gluYc', 'law', 'lap', 'las',
        'laK', 'laB', 'laC', 'laz', 'tus', 'tur', 'tup', 'SAn', 'tuw', 'tud',
        'SAq', 'vara', 'varc', 'tuq', 'SAs', 'tuj', 'tuh', 'varh', 'tul',
        'SAK', 'tuz', 'tuP', 'varz', 'varD', 'tuB', 'varR', 'tuR', 'riK',
        'trump', 'aYj', 'hfz', 'aYc', 'tfp', 'GfR', 'vAsa', 'banD', 'tvac',
        'Gfz', 'tvar', 'cumb', 'rE', 'rA', 'rI', 'Deka', 'smf', 'smi', 'maYc',
        'ri', 'duz', 'AYC', 'GUrR', 'truw', 'dyut', 'trup', 'sPuRw', 'aww',
        'dul', 'vyuz', 'duh', 'SvaYc', 'klIb', 'vft', 'vfj', 'vfk', 'vfh',
        'diS', 'vfD', 'mrakz', 'dih', 'vfS', 'kumAra', 'vfR', 'div', 'Sev',
        'vizka', 'INK', 'GuRR', 'rag', 'spfha', 'ram', 'rak', 'rah', 'mind',
        'raw', 'ras', 'rap', 'muRW', 'rad', 'ray', 'raG', 'raB', 'muRq', 'raK',
        'raW', 'raP', 'raD', 'stamB', 'palyUla', 'kzipa', 'camp', 'GfRR', 'do',
        'hrI', 'stfh', 'nand', 'piYj', 'bust', 'kul', 'Bid', 'sur', 'ned',
        'tvaYc', 'KaRq', 'baD', 'baR', 'bad', 'sraMs', 'SraT', 'bal', 'cakAs',
        'nud', 'muz', 'luYj', 'raMh', 'muR', 'muw', 'mus', 'mur', 'BUz', 'mud',
        'muc', 'muj', 'kAla', 'und', 'tF', 'dIkz', 'nakk', 'pAl', 'mantr',
        'puww', 'nakz', 'drE', 'puwa', 'mluc', 'liNg', 'DaR', 'tutTa', 'yez',
        'Co', 'sad', 'dyE', 'Ikz', 'iw', 'nikz', 'il', 'cand', 'stIm', 'iz',
        'durv', 'Svart', 'iK', 'plih', 'tvakz', 'nij', 'nil', 'Svi', 'kit',
        'kiw', 'kil', 'prA', 'ruMs', 'yAc', 'niS', 'ruMS', 'kala', 'prI',
        'SraR', 'kall', 'pyAy', 'yakz', 'Dan', 'GaG', 'hal', 'han', 'Sram',
        'Gaw', 'had', 'hay', 'vizk', 'has', 'haw', 'jri', 'jyA', 'SraTa',
        'jyu', 'Svall', 'Svalk', 'vawa', 'umB', 'stfkz', 'aNga', 'gozw',
        'SaNk', 'ciri', 'plu', 'pluz', 'nizk', 'plI', 'vaNK', 'Cur', 'Cup',
        'SUz', 'trap', 'Dras', 'tras', 'tan', 'vaNk', 'tal', 'tak', 'SUl',
        'vaNg', 'SUr', 'tay', 'taw', 'tap', 'saBAja', 'vevI', 'daRqa', 'pakz',
        'nI', 'raha', 'kuMs', 'Siw', 'SraNg', 'nF', 'hamm', 'SraNk', 'nU',
        'Sil', 'Siz', 'kuMS', 'vezw', 'sUca', 'wik', 'pUrR', 'kaTa', 'vAh',
        'tumP', 'sfj', 'mU', 'tump', 'pust', 'Si', 'tumb', 'knUy', 'nIv',
        'sfB', 'tark', 'veT', 'lABa', 'snih', 'guRq', 'kzmAy', 'roq', 'guRa',
        'veR', 'sUd', 'vep', 'must', 'bfh', 'guRW', 'veh', 'jaz', 'guP', 'guD',
        'guq', 'guj', 'guh', 'gur', 'gup', 'gud', 'qip', 'Pakk', 'SI', 'GrA',
        'svid', 'kamp', 'DvaMs', 'rasa', 'prez', 'QOk', 'SmIl', 'SvaW', 'kzaR',
        'caz', 'caR', 'Bram', 'kzal', 'kzam', 'cay', 'cad', 'car', 'cap',
        'cat', 'caw', 'cak', 'cah', 'can', 'cam', 'cal', 'Bez', 'BraR', 'kzar',
        'BAz', 'SvaBr', 'UrRu', 'BAs', 'mluYc', 'vakz', 'BAm', 'mas', 'pfc',
        'pfq', 'svara', 'mav', 'may', 'mad', 'Urj', 'snu', 'laNK', 'sfmB',
        'laNG', 'mah', 'mal', 'svard', 'maz', 'maW', 'maT', 'snA', 'sf', 'pfR',
        'f', 'si', 'so', 'kurd', 'pfT', 'laNg', 'maK', 'maR', 'cuww', 'j*z',
        'pUz', 'dyu', 'pUl', 'pUj', 'kfRv', 'stana', 'Jaz', 'pUr', 'Svit',
        'stena', 'kuRa', 'kuRq', 'KAd', 'kuRW', 'bfMh', 'paRq', 'rakz', 'kram',
        'tantr', 'ej', 'rUpa', 'CaYj', 'kand', 'BAja', 'Svind', 'krap', 'tUR',
        'tUr', 'Kel', 'paza', 'eD', 'eW', 'kraT', 'dfMh', 'ez', 'yuD', 'Dukz',
        'carv', 'tam', 'punT', 'carb', 'carc', 'yuC', 'saYj', 'yup', 'yut',
        'yuj', 'turv', 'Dfz', 'mArg', 'kzaYj', 'tfd', 'muYc', 'ukz', 'mArj',
        'de', 'kAS', 'tfh', 'df', 'du', 'dI', 'DUp', 'DUr', 'DUs', 'Sucy',
        'lumb', 'dA', 'tfz', 'dE', 'kAs', 'tfR', 'dF', 'dU', 'huq', 'Brakz',
        'hul', 'Kurd', 'Irkzy', 'GiRR', 'vAta', 'sah', 'san', 'sam', 'sal',
        'sac', 'sag', 'pru', 'ant', 'sas', 'sap', 'and', 'kliS', 'saw', 'kusm',
        'saR', 'duHKa', 'saG', 'raRv', 'klid', 'sraNk', 'dakz', 'dIp', 'dram',
        'niYj', 'traNk', 'DrE', 'hmal', 'taYc', 'sTuq', 'ruRw', 'Gaww', 'bAq',
        'bAh', 'ruRW', 'paMs', 'bAD', 'garva', 'SaRq', 'gep', 'gev', 'BaRq',
        'gez', 'vaRW', 'svAd', 'Dru', 'stoma', 'vaRw', 'sTA', 'vaRq', 'manT',
        'ji', 'vraj', 'mand', 'sparD', 'jF', 'trOk', 'vraR', 'kfS', 'stup',
        'hvf', 'stuc', 'spand', 'marb', 'marc', 'siv', 'DrANkz', 'Buv', 'pruz',
        'Buj', 'marv', 'naK', 'stuB', 'cft', 'daridrA', 'takz', 'krand',
        'cyut', 'paS', 'mfq', 'paT', 'mfj', 'SunD', 'kzur', 'kzud', 'mfd',
        'cul', 'kzuB', 'paw', 'pad', 'samb', 'mfR', 'mfS', 'pac', 'kzuD',
        'mfD', 'SloR', 'pan', 'srek', 'SlaT', 'miYj', 'Iz', 'ujJ', 'jE', 'nah',
        'Ir', 'Ih', 'Ij', 'juNg', 'Sulk', 'Iq', 'Sulb', 'Scyut', 'uYC', 'rUz',
        'huRq', 'Bal', 'hinv', 'Baj', 'pER', 'stim', 'amb', 'stip', 'druR',
        'saMst', 'stiG', 'psA', 'nu', 'jakz', 'kfpa', 'gruc', 'sAmb', 'sAma',
        'Kuj', 'BraMs', 'dinv', 'BraMS', 'oR', 'oK', 'gumP', 'mF', 'cuqq',
        'kAYc', 'sru', 'yat', 'heW', 'kFt', 'garh', 'garb', 'nAs', 'gard',
        'garv', 'loc', 'loq', 'lok', 'heq', 'nAT', 'garD', 'juq', 'SUra',
        'yaj', 'kzRu', 'SUrp', 'sarv', 'juz', 'sAntv', 'DrAK', 'aq', 'ag',
        'ah', 'ak', 'aj', 'am', 'an', 'as', 'kruS', 'aw', 'at', 'av', 'ay',
        'ad', 'SumB', 'tsar', 'kruq', 'tviz', 'aR', 'aS', 'az', 'tfMh', 'ru',
        'tAy', 'vAS', 'parRa', 'mask', 'vf', 'u', 'caYc', 'kvaR', 'SiNG',
        'krIq', 'SIB', 'cukk', 'kumB', 'kvaT', 'kumb', 'SIk', 'mnA', 'kundr',
        'SIl', 'kuts', 'taq', 'SalB', 'sPAy', 'Cidra', 'daMS', 'anDa', 'fmP',
        'suh', 'GUr', 'daMs', 'mUtra', 'valk', 'Pull', 'valh', 'valg', 'Ceda',
        'maha', 'valB', 'kleS', 'Tuq', 'Cand', 'vic', 'cAy', 'raNK', 'vij',
        'raNG', 'vil', 'vis', 'viw', 'vid', 'viC', 'pAra', 'raNg', 'viz',
        'viT', 'viD', 'glas', 'glah', 'So', 'gfD', 'vel', 'hlas', 'gfj', 'gfh',
        'nind', 'SF', 'kaMs', 'mall', 'hlag', 'syand', 'SE', 'laYj', 'jYap',
        'vAYC', 'grAma', 'muYj', 'vfkz', 'vruq', 'wval', 'pay', 'trE', 'praT',
        'Samb', 'praC', 'styE', 'pras', 'Cid', 'panT', 'mfz', 'Baw', 'Bas',
        'cel', 'piRq', 'mruc', 'tuRq', 'yu', 'iNK', 'Baz', 'kzev', 'yA', 'iNg',
        'BaR', 'KaYj', 'gaYj', 'puRq', 'puRw', 'hary', 'waNk', 'yUz', 'SvaRW',
        'IS', 'pul', 'bast', 'kunT', 'puq', 'jIv', 'Una', 'puw', 'niMs', 'pur',
        'vfz', 'puT', 'puz', 'jez', 'yantr', 'mIl', 'suKa', 'vell', 'kaRW',
        'mIv', 'kaRq', 'DI', 'parb', 'spfS', 'DA', 'parp', 'DF', 'DU', 'kruYc',
        'Di', 'baMh', 'dfmP', 'De', 'Df', 'Du', 'karv', 'liK', 'karb', 'klind',
        'liS', 'karj', 'galh', 'taNg', 'Kid', 'sPUrj', 'mfga', 'riRv', 'lih',
        'drek', 'Kiw', 'lip', 'galB', 'buNg', 'kac', 'kab', 'kag', 'Sikz',
        'kak', 'kan', 'kam', 'kal', 'kas', 'BrUR', 'kF', 'kaw', 'hUq', 'kaK',
        'ki', 'kaR', 'kaS', 'kaz', 'kf', 'ku', 'kaW', 'drAh', 'piMs', 'drAq',
        'aRW', 'varRa', 'lUz', 'kaqq', 'Diz', 'hiw', 'gaveza', 'nivAsa', 'fYj',
        'hil', 'skamB', 'BU', 'svaYj', 'sev', 'arv', 'ard', 'arb', 'barb',
        'maRq', 'arh', 'barh', 'arj', 'ark', 'sek', 'Brasj', 'maRW', 'jYA',
        'knas', 'satra', 'sKal', 'sKad', 'lasj', 'pF', 'pU', 'stE', 'pA', 'pE',
        'stF', 'pI', 'daG', 'dad', 'day', 'Card', 'pf', 'SyE', 'das', 'dah',
        'dal', 'dam', 'stf', 'pi', 'stu', 'tev', 'gad', 'vand', 'aMsa', 'puMs',
        'gam', 'gal', 'gaj', 'gaq', 'vyaya', 'taNk', 'SfD', 'granT', 'Dvf',
        'rih', 'vaBr', 'ric', 'riz', 'riS', 'riP', 'SlAK', 'SlAG', 'SoR',
        'Karb', 'raR', 'vye', 'Bfq', 'Bfj', 'mreq', 'bukk', 'cuw', 'cur',
        'cud', 'mavy', 'cuq', 'BfS', 'kzmIl', 'snas', 'guYj', 'bil', 'lAG',
        'Bakz', 'kzu', 'kzi', 'biw', 'Dakk', 'kzE', 'kzip', 'proT', 'pez',
        'pev', 'kaq', 'pes', 'pel', 'larb', 'kziR', 'ruj', 'ruh', 'ruc',
        'sriv', 'goma', 'rud', 'hiRq', 'rup', 'ruw', 'aMh', 'uNK', 'Barv',
        'ruD', 'sAD', 'ruz', 'ruS', 'ruW', 'hizk', 'spaS', 'Byas', 'kzvid',
        'taMs', 'arTa', 'luRW', 'uz', 'uK', 'uC', 'uB', 'cil', 'cit', 'uh',
        'ciw', 'kuha', 'syam', 'uc', 'naB', 'kfz', 'lozw', 'naS', 'yuNg',
        'paYc', 'druh', 'kfp', 'kft', 'BlAS', 'nal', 'nas', 'naw', 'kfq',
        'nad', 'nay', 'SIla', 'Dvana', 'pIl', 'pIq', 'jUr', 'pIv', 'svf', 'gu',
        'sUrkzy', 'kzowa', 'kUw', 'Sriz', 'kUl', 'kUj', 'gF', 'ganD', 'kUR',
        'caha', 'gA', 'jaMs', 'KyA', 'yOw', 'vlI', 'raca', 'saMketa', 'jval',
        'jfmB', 'hiMs', 'vela', 'jvar', 'kaNk', 'lep', 'DyE', 'dIDI', 'katra',
        'vANkz', 'lAK', 'tim', 'til', 'tik', 'tij', 'Dinv', 'tip', 'lAj',
        'cill', 'Blakz', 'Gur', 'aBr', 'Guw', 'damB', 'sUrkz', 'GuR', 'Guz',
        'rUkza', 'jAgf', 'siD', 'siB', 'cUrR', 'lamb', 'gurv', 'nard', 'maBr',
        'aNk', 'gurd', 'aNg', 'sic', 'sil', 'raYj', 'dfB', 'F', 'klam', 'purv',
        'dfh', 'klaT', 'taRq', 'siw', 'bind', 'dfp', 'trand', 'lA', 'jiri',
        'hras', 'lI', 'maNk', 'garj', 'glez', 'hrag', 'SuRW', 'gfYj', 'maNK',
        'glev', 'glep', 'maNG', 'Cad', 'SaR', 'qap', 'Cam', 'SranT', 'Saz',
        'SaW', 'Sak', 'Sam', 'Sal', 'Caz', 'Kaww', 'Sad', 'BaYj', 'Sas', 'Sap',
        'Sav', 'rez', 'reB', 'skand', 'citra', 'rep', 'rev', 'svan', 'svap',
        'rek', 'svad', 'GaRw', 'vah', 'sU', 'lunT', 'DvaYj', 'dfS', 'jinv',
        'man', 'cyu', 'BAma', 'Bind', 'Ku', 'KE', 'arc', 'nft', 'kuww', 'miC',
        'drA', 'su', 'miz', 'Pal', 'mih', 'mil', 'mid', 'dru', 'PaR', 'rAG',
        'rAK', 'maMh', 'Sliz', 'rAD', 'sramB', 'skund', 'rAj', 'urv', 'rAs',
        'pyE', 'Svac', 'Sval', 'Svas', 'mUl', 'jaB', 'mUz', 'kuYc', 'jaw',
        'jas', 'BfMS', 'jan', 'jal', 'jam', 'jaj', 'fP', 'fz', 'fD', 'fC',
        'kANkz', 'gras', 'grah', 'fc', 'lU', 'fj', 'luW', 'mfkz', 'luB', 'luw',
        'karta', 'cuRq', 'luq', 'cuRw', 'kel', 'Sri', 'ramP', 'Sru', 'ramB',
        'kep', 'SrA', 'SrE', 'kland', 'KuRq', 'vrI', 'ramb', 'ci', 'ac', 'yaB',
        'sarj', 'sPul', 'nIl', 'sPuq', 'DmA', 'yas', 'kIw', 'yam', 'kIl',
        'sPuw', 'sPur', 'Irzy', 'till', 'kUwa', 'vyaT', 've', 'aNka', 'vyaD',
        'kruD', 'SOw', 'vA', 'vE', 'vI', 'vyay', 'vF', 'vyac', 'cint', 'balh',
        'dAs', 'dAn', 'DvaR', 'caRq', 'i', 'dAS', 'riNg', 'gAh', 'Dvan',
        'Dvaj', 'piC', 'BA', 'sAra', 'BI', 'SaS', 'dev', 'Cfd', 'BF',
        'saMgrAma', 'cucy', 'lakz', 'gluc', 'sku', 'jarj', 'tej', 'aqq', 'tep',
        'Bf', 'Kewa', 'mruYc', 'suww', 'DAv', 'Suc', 'Sun', 'vaYc', 'sPiww',
        'murv', 'SuB', 'tvaNg', 'murC', 'SuW', 'Suz', 'SuD', 'Uy', 'cUr',
        'vraSc', 'tIra', 'krI', 'Uh', 'cUz', 'Uz', 'naNK', 'vaK', 'vaR',
        'mrad', 'tUz', 'cIk', 'cIv', 'katT', 'wIk', 'vaz', 'vaS', 'kzamp',
        'lAYC', 'vaj', 'cIB', 'kzIv', 'Ball', 'van', 'vam', 'vac', 'smiw',
        'vad', 'vay', 'lAYj', 'kzIb', 'vas', 'vap', 'kzIj', 'bus', 'hf',
        'cakz', 'kmar', 'buD', 'cakk', 'hA', 'laRq', 'ind', 'hval', 'inv',
        'pis', 'piw', 'wal', 'JarJ', 'inD', 'mlE', 'gfha', 'piz', 'piS',
        'vIra', 'brUs', 'traMs', 'ubj', 'tfkz', 'hnu', 'sasj'
    ]

    Error = []
    x = 0
    errors = 0
    fish = 0
    count_num = [0, 0, 0]

    yes = []
    no = []
    not_sure = []
    test = ""
    count_0 = 0
    count_1 = 0
    report = 0
    for key in dic:
        for each in dic[key]:
            result = [0, 0, 0, 0]
            temp = 0
            check = 100
            if len(each.split(" ")) > 2:
                fish += 1
                continue
            elif len(each.split(" ")) == 2:
                source = each.split(" ")[0]
            else:
                source = each
            derived = key
            if source[-2:] == "kf":
                continue
            vowel_count = 0
            if two_vowels:
                for char in source:
                    if char in l_vow or char in s_vow:
                        vowel_count += 1
                if vowel_count == 2:
                    result[2] = 1
            else:
                result[2] = 0

            if last_second != "":
                try:
                    if source[-2] == last_second:
                        result[3] = 1
                    else:
                        result[3] = 0
                except IndexError:
                    result[3] = 0
            else:
                result[3] = 0
            if len(source) <= 2:
                continue
            while (temp < len(source)):
                if source[temp] in s_vow:
                    if source[temp] == "a":
                        if derived[temp] == "A":
                            check = 1
                            break
                        else:
                            check = 0
                            break
                    if source[temp] == "e" or source[temp] == "i" or source[
                            temp] == "I":
                        if derived[temp] == "E":
                            check = 1
                            break
                        else:
                            check = 0
                            break
                    if source[temp] == "u" or source[temp] == "o" or source[
                            temp] == "U":
                        if derived[temp] == "O":
                            check = 1
                            break
                        else:
                            check = 0
                            break
                    if source[temp] == "f":
                        if derived[temp:temp + 2] == "Ar":
                            check = 1
                            break
                        else:
                            check = 0
                            break
                elif source[temp] in l_vow:
                    if derived[temp] == source[temp]:
                        check = -1
                    else:
                        check = 0
                    break
                temp += 1
                if temp >= len(source):
                    break
            if type(vruddhi) is bool:
                if check is 1:
                    if vruddhi:
                        ans = 1
                    else:
                        ans = 0
                elif check is 0:
                    if vruddhi:
                        ans = 0
                    else:
                        ans = 1
                elif check is -1:
                    ans = -1
                elif check is 100:
                    errors += 1
                    Error.append(x)
                    check = -1
            else:
                ans = check

            if len(ends_with) > 0:
                if str(source)[len(source) - 1] in ends_with:
                    result[1] = 1
                else:
                    result[1] = 0
            else:
                result[1] = 0

            lis = sample.main()

            report_check = 0
            for each1 in lis:
                if len(each1) < 1:
                    continue
                if source.startswith(each1):
                    if source[len(each1):]:
                        report_check = 1
                        break
            if report_check == 1:
                if len(each.split(" ")) < 2:
                    report += 1
                    continue

            if len(each.split(" ")) > 1:
                if int(each.split(" ")[1]) == 0:
                    count_0 += 1
                elif int(each.split(" ")[1]) == 1:
                    count_1 += 1
                else:
                    print "WTF"
                seeds_string += "N" + str(count + x) + '\t' + "L" + str(
                    int(each.split(" ")[1]) + 1) + '\t' + "1.0\n"
            else:
                if vruddhi == True and check == 0:
                    seeds_string += "N" + str(count +
                                              x) + '\t' + "L1" + '\t' + "1.0\n"
                    count_0 += 1
                if vruddhi == False and check == 1:
                    seeds_string += "N" + str(count +
                                              x) + '\t' + "L1" + '\t' + "1.0\n"
                    count_0 += 1

            result[0] = 1
            temp_node_list = []
            temp_node_list.append("N" + str(count + x))
            temp_node_list.append(result)

            if ans is 1:
                yes.append(temp_node_list)
            elif ans is 0:
                no.append(temp_node_list)
            elif ans is -1:
                not_sure.append(temp_node_list)
            temp_dic = {}
            temp_dic[key] = [each, result]
            node_dict[x + count] = temp_dic
            x += 1

    for i in range(len(yes)):
        for j in range(i + 1, len(yes)):
            weight = 0
            for k in range(4):
                if yes[i][1][k] == 1 and yes[j][1][k] == 1:
                    weight += 1
            weight = float(weight) / float(total)
            string += yes[i][0] + '\t' + yes[j][0] + '\t' + str(weight) + "\n"

    for i in range(len(no)):
        for j in range(i + 1, len(no)):
            weight = 0
            for k in range(4):
                if no[i][1][k] == 1 and no[j][1][k] == 1:
                    weight += 1
            weight = float(weight) / float(total)
            string += no[i][0] + '\t' + no[j][0] + '\t' + str(weight) + "\n"

    for i in range(len(not_sure)):
        for j in range(i + 1, len(not_sure)):
            weight = 0
            for k in range(4):
                if not_sure[i][1][k] == 1 and not_sure[j][1][k] == 1:
                    weight += 1
            weight = float(weight) / float(total)
            string += not_sure[i][0] + '\t' + not_sure[j][0] + '\t' + str(
                weight) + "\n"

    for i in range(len(not_sure)):
        for j in range(len(yes)):
            weight = 0
            for k in range(4):
                if not_sure[i][1][k] == 1 and yes[j][1][k] == 1:
                    weight += 1
            weight = float(weight) / (2 * float(total))
            string += not_sure[i][0] + '\t' + yes[j][0] + '\t' + str(
                weight) + "\n"
        for j in range(len(no)):
            weight = 0
            for k in range(4):
                if not_sure[i][1][k] == 1 and no[j][1][k] == 1:
                    weight += 1
            weight = float(weight) / (2 * float(total))
            if weight < 0:
                print "**** ERROR ****"
            string += not_sure[i][0] + '\t' + no[j][0] + '\t' + str(
                weight) + "\n"

    num_vruddhi = 0
    not_vruddhi = 0
    if vruddhi == True or type(vruddhi) != bool:
        num_vruddhi = len(yes)
    elif vruddhi == False:
        num_vruddhi = len(no)
    if vruddhi == True or type(vruddhi) != bool:
        not_vruddhi = len(no)
    elif vruddhi == False:
        not_vruddhi = len(yes)
    not_sure_vruddhi = len(not_sure)
    count += x
    print report
    count_list = [
        "part" + str(index), count_0, count_1, count - 1, num_vruddhi,
        not_vruddhi, not_sure_vruddhi
    ]
    return (node_dict, string, count, seeds_string, count_0, count_list)
示例#13
0
import sample

sample.main()

print('Second module"s name: {}'.format(__name__))
示例#14
0
 def test_main(self):
     main()
    def train(self, filename, output_dir):
        logging.basicConfig(level=LOGGING_LEVEL, format="DEBUG: %(message)s")

        all_filename = filename

        try:
            os.mkdir(output_dir)
        except OSError: # directory already exists
            pass

        train_filename = path.join(output_dir, 'train.txt')
        dev_filename = path.join(output_dir, 'dev.txt')

        dev_percent = 0.1

        # sample all-data into train and dev sets
        sample.main( [all_filename, train_filename, dev_filename, dev_percent] )
        logging.debug('Split {0} into training ({1}) and development ({2})'.format(all_filename, train_filename, dev_filename))
        
        # train models on training set
        self.models = {}

        def add_model(ModelClass, name):
            self.models[name] = ModelClass()
            self.models[name].train(train_filename)

            logging.debug('Done training {0} model'.format(name))

        add_model( Unigram,  'unigram' )
        add_model( Bigram,   'bigram' )
        add_model( Trigram,  'trigram' )
        add_model( Fourgram, 'fourgram' )
        add_model( Fivegram, 'fivegram' )
        add_model( Sixgram,  'sixgram' )
        add_model( Sevengram, 'sevengram')
        add_model( Eightgram, 'eightgram')
        add_model( Maxent,   'maxent' )

        #self.models['bigram'].backoff_model   = self.models['unigram']
        #self.models['trigram'].backoff_model  = self.models['bigram']
        #self.models['fourgram'].backoff_model = self.models['trigram']
        #self.models['fivegram'].backoff_model = self.models['fourgram']
        #self.models['sixgram'].backoff_model  = self.models['fivegram']

        dev_words = [line.strip() for line in open(dev_filename, 'r')]

        # write predictions out to disk using dev set
        model_outputs = []
        model_output_dir = tempfile.mkdtemp()
        logging.debug('Temporary Output Directory: {0}'.format(model_output_dir))
        for model_name in self.model_names:
            model = self.models[model_name]

            model_outputs.append( path.join( model_output_dir, model_name + '.probs' ) )
            model.write_probability_list(dev_words, model_outputs[-1])
            logging.debug('Wrote dev set predictions using {0} model'.format(model_name))

        # interpolate the models, get the weights
        weights_list = interpolate.interpolate(model_outputs)
        logging.debug('Weights: {0}'.format(weights_list))

        self.weights = dict( zip( self.model_names, weights_list ) )
示例#16
0
def test_instrumentation(sample):
    sample.main()
示例#17
0
            frameId = cap.get(1) #current frame number
            ret, frame = cap.read()
            if (ret != True):
                break
            if (frameId % math.floor(frameRate) == 0):
                filename ="frame%d.jpg" % count;count+=1
                cv2.imwrite("{}/{}".format(directory,filename), frame)
        cap.release()
        
        print ("Done!")
    DIR="{}/".format(directory)
    print(directory)
    answer=""
    count=50
    for i in range(count):
        ans=sample.main(image="{}/frame{}.jpg".format(DIR,i))
        answer+=ans
        
    text_file = open("Output.txt", "w")
    text_file.write(answer)
    text_file = open("Output.txt", "r")
    text=text_file.read()
    tt.append(answer)
    final_ans=' '.join(unique_list(text.split("<end>")))
    text_file.close()
    ff.append(final_ans.replace("<start>",""))
#text_file ="Output.txt"
#text_file = open("Output.txt", 'r').read()
#print(text_file)
#generate_summary( text_file, 3)
#img = plt.imread('frame0.jpg')   #
示例#18
0
    def _sampleIteration(self):
        order = range(self.levels+1+len(self.samplers))

        if self.randomSamplerOrder:
            order = np.random.choice(order,len(order),replace=False)

        for o in order:
            if o <= self.levels:
                prior = self.priors['functions'][o]
                prior.sample(self.model,self.yKernel)
            else:
                obj, param, sampler = self.samplers[o-self.levels-1]
                # print param, obj

                if obj == self.yKernelOld:
                    obj = self.yKernel
                    if param == 'k1_sigma':
                        obj.__dict__['k1'].sigma = sampler.sample(obj.__dict__['k1'].sigma)
                    elif param == 'k2_sigma':
                        obj.__dict__['k2'].sigma = sampler.sample(obj.__dict__['k2'].sigma)
                    elif param == 'k2_lengthscale':
                        obj.__dict__['k2'].lengthscale = sampler.sample(obj.__dict__['k2'].lengthscale)
                    else:
                        raise ValueError("unknown parameter %s!"%param)
                else:
                    obj.__dict__[param] = sampler.sample(obj.__dict__[param])

if __name__ == "__main__":
    main(SampleIntegrate)
示例#19
0
# -*- coding: utf-8 -*-

import sample.main


def main():
    sample.main.main()


if __name__ == "__main__":
    main()
示例#20
0
# -*- coding: utf-8 -*-
import sample

print ('python-izm')
print ("python-izm")

sample.main()
示例#21
0
 def test_main(self):
     self.assertTrue(main() == 0)
示例#22
0
def get_text(author):
    return sample.main(author)