当前位置: 首页>>代码示例>>Python>>正文


Python Match.match_list方法代码示例

本文整理汇总了Python中match.Match.match_list方法的典型用法代码示例。如果您正苦于以下问题:Python Match.match_list方法的具体用法?Python Match.match_list怎么用?Python Match.match_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在match.Match的用法示例。


在下文中一共展示了Match.match_list方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: matchobj

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
def matchobj(daf_num, amud, text):
    new_shas =[]
    index = (daf_num-2)*2
    if amud=="b":
        index= index + 1
    list =text.split(" ")
    string= " ".join(list[0:7])
    string = re.sub(ur'(?:@|[0-9]|<|>|b|\[|\*|\])',"",string)
    match_obj = Match(min_ratio=50, guess =True)
    for line in shas[index]:
        new_line = re.sub(ur'<[^<]+?>',"",line)
        new_shas.append(new_line)
    #print string, daf_num, amud
    results = match_obj.match_list([string], new_shas)
    return(results)
开发者ID:BenjaminKozuch,项目名称:Sefaria-Data,代码行数:17,代码来源:rosh_menachot.py

示例2: match_and_link

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
def match_and_link(text, masechet):
	match = Match(in_order=True, min_ratio=80, guess=False, range=True, can_expand=False)
	for daf_count, daf in enumerate(text):
		dhs = []
		comments = []
		for each_line in daf:
			if each_line.find("כו'") >= 0:
				dh, comment = each_line.split("כו'", 1)
			elif each_line.find(".") >= 0:
				dh, comment = each_line.split(".", 1)
			else:
				dh, comment = splitText(each_line, 10)
			dhs.append(dh)
			comments.append(comment)
		pdb.set_trace()
		talmud_text = get_text_plus(masechet+"."+AddressTalmud.toStr("en", daf_count+3))['he']
		result = match.match_list(dhs, talmud_text)
开发者ID:agvania,项目名称:Sefaria-Data,代码行数:19,代码来源:parse.py

示例3: post

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
def post(text, dh_dict, tractate):
     text_array = convertDictToArray(text)
     send_text = {
         "text": text_array,
         "versionTitle": "Ramban on Talmud",
         "versionSource": "http://www.sefaria.org",
         "language": "he"
     }
     post_text("Chiddushei Ramban on "+tractate, send_text)
     links_to_post = []
     daf_array = get_text_plus(tractate)['he']
     match = Match(in_order=True, min_ratio=80, guess=False, range=True, can_expand=False)
     for daf in sorted(dh_dict.keys()):
         dh_list = dh_dict[daf]
         results = match.match_list(dh_list, daf_array[daf-1], tractate+" "+AddressTalmud.toStr("en", daf))
         for key, value in results.iteritems():
             value = value.replace("0:", "")
             talmud_end = tractate + "." + AddressTalmud.toStr("en", daf) + "." + value
             ramban_end = "Chiddushei_Ramban_on_" + tractate + "." + AddressTalmud.toStr("en", daf) + "." + str(key)
             links_to_post.append({'refs': [talmud_end, ramban_end], 'type': 'commentary', 'auto': 'True', 'generated_by': "ramban"+tractate})
     post_link(links_to_post)
开发者ID:joshuagoldmeier,项目名称:Sefaria-Data,代码行数:23,代码来源:ramban.py

示例4: post

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
def post(text, dh_dict):
     actual_text = {}
     for perek in text:
         actual_text[perek] = convertDictToArray(text[perek])
     text_to_post = convertDictToArray(actual_text)
     send_text = {"text":text_to_post,
                         "versionTitle":"OYW",
                        "versionSource": "http://mobile.tora.ws/",
                        "language":"he"
                         }
     post_text("Gur Aryeh on "+book, send_text)

     links = []
     for perek in dh_dict:
        for passuk in dh_dict[perek]:


            dh_list = dh_dict[perek][passuk]
            rashi_text = get_text_plus("Rashi on "+book+"."+str(perek)+"."+str(passuk))['he']
            match_out_of_order = Match(in_order=False, min_ratio=85, guess=True, range=True, can_expand=False)
            results = match_out_of_order.match_list(dh_orig_list=dh_list, page=rashi_text, ref_title="Gur Aryeh")
            for dh_pos in results:
                result = results[dh_pos].replace("0:","")
                if result.find('-')>=0:
                    x,y = result.split('-')
                    if int(x)>int(y):
                        pdb.set_trace()
                links.append({
                    "refs": [
                        "Rashi on "+book+"."+str(perek)+"."+str(passuk)+"."+result,
                        "Gur Aryeh on "+book+"."+str(perek)+"."+str(passuk)+"."+str(dh_pos)
                    ],
                    "type": "commentary",
                    "auto": True,
                    "generated_by": "Gur Aryeh on "+book+" linker"})
     	post_link(links)
     	links = []
开发者ID:JonMosenkis,项目名称:Sefaria-Data,代码行数:39,代码来源:gur_aryeh.py

示例5: len

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
        line = line.replace("\n", "")
        something = line.replace(" ", "")
        if len(something) > 0:
            if count % 2 == 0:
                dh_dict[i + 3].append(line)
            else:
                rashi_comments[i + 3].append(line)
            count += 1
    f.close()
comments = 0
for i in range(54):
    book[str(i + 3)] = get_text(title_book + "." + AddressTalmud.toStr("en", i + 3))
    lines = len(book[str(i + 3)])
    if len(dh_dict[i + 3]) > 0:
        match_obj = Match(in_order=True, min_ratio=70, guess=False)
        result = match_obj.match_list(dh_dict[i + 3], book[str(i + 3)], "Keritot " + AddressTalmud.toStr("en", i + 3))
        matched += getMatched(result)
        total += getTotal(result)
        guess += getGuesses(result)
        non_match += getNotMatched(result)
        log_info = getLog(i + 3, result, dh_dict, rashi_comments)
        if log_info != []:
            log.append(log_info)
        result_dict = {}
        for key in result:
            line_n = result[key][0]
            if line_n in result_dict:
                result_dict[line_n] += 1
            else:
                result_dict[line_n] = 1
            if line_n > 0:
开发者ID:stevekaplan123,项目名称:Sefaria-Data,代码行数:33,代码来源:rashi_keritot.py

示例6: len

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
guess=0
no_guess=0
for daf in dh_dict.keys():
	if len(dh_dict[daf]) != len(comm_dict[daf]):
		pdb.set_trace()
for daf in dh_dict.keys():
	text = get_text("Gittin."+AddressTalmud.toStr("en", daf))
	try:
		match_obj=Match(in_order=True, min_ratio=70, guess=False, range=True, maxLine=len(text)-1)
	except:
		pdb.set_trace()
	dh_arr = []
	for i in range(len(dh_dict[daf])):
		if len(dh_dict[daf][i]) > 0:
			dh_arr.append(dh_dict[daf][i])
	result[daf] = match_obj.match_list(dh_arr, text)
	dh_count = 1
	'''
	if len(dh_dict[daf][i]) == 0, then comm_dict[daf][i] gets added to comm_dict[daf][i-1]+"<br>"
	'''
	for i in range(len(comm_dict[daf])):
		 if (daf, i) in before_dh_dict:
		 	comm_dict[daf][i] = before_dh_dict[(daf, i)]+"<b>"+dh_dict[daf][i]+"</b>"+comm_dict[daf][i]
		 else:
		 	comm_dict[daf][i] = "<b>"+dh_dict[daf][i]+"</b>"+comm_dict[daf][i]
	found = 0
	if len(dh_dict[daf][0]) == 0:
		pdb.set_trace()
	for i in range(len(dh_dict[daf])):
		if len(dh_dict[daf][i]) > 0:
			old_found = found
开发者ID:BenjaminKozuch,项目名称:Sefaria-Data,代码行数:33,代码来源:rashba_gittin.py

示例7: len

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
		line = line.replace("\n", "")
		something = line.replace(" ", "")
		if len(something) > 0:
			if count % 2 == 0:
				dh_dict[i+3].append(line)
			else:
				rashi_comments[i+3].append(line)
			count+=1
	f.close()		
for j in range(2):
	i = j+149
	book[str(i+3)] = get_text(title_book+"."+AddressTalmud.toStr("en", i+3))
	lines = len(book[str(i+3)])
	if len(dh_dict[i+3]) > 0: 
		match_obj=Match(in_order=True, min_ratio=70, guess=False)
		result=match_obj.match_list(dh_dict[i+3], book[str(i+3)])
		matched += getMatched(result)
		total += getTotal(result)
		guess += getGuesses(result)
		non_match += getNotMatched(result)
		log_info = getLog(i+3, result, dh_dict, rashi_comments)
		if log_info != []:
			log.append(log_info)
		result_dict = {}
		for key in result:
			line_n = result[key][0]
			if line_n in result_dict:
				result_dict[line_n] += 1
			else:
				result_dict[line_n] = 1
			if line_n > 0:
开发者ID:ngocthanhit,项目名称:Sefaria-Data,代码行数:33,代码来源:tosafot_avodah_zarah.py

示例8: compileCommentaryIntoPage

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]

for category in categories:
  if category=='paragraph':
  	continue
  elif category=='gemara':
  	title = masechet
  elif category=='rashi':
  	title = "Rashi on "+masechet
  elif category=='tosafot':
  	title = "Tosafot on "+masechet
  	
  for daf in dh_dict[category]:
  	dh_arr = dh_dict[category][daf]
  	text = compileCommentaryIntoPage(title, daf)
	result = match_obj.match_list(dh_arr, text, title+" "+AddressTalmud.toStr("en", daf))
	for key in result:
		if result[key][0] != 0 and key % 2 == 1:
			masechet_daf_line_start = lookForLineInCommentary(title, daf, result[key][0])
			masechet_daf_line_end = lookForLineInCommentary(title, daf, result[key][1])
			#need to check if the range could be valid, not if end is greater than start
				masechet_daf_line = Ref(masechet_daf_line_start).to(Ref(masechet
			else:
				masechet_daf_line = masechet_daf_line_start
			post_link({
				"refs": [
						 masechet_daf_line,
						"Maharam Shif on "+masechet+"."+AddressTalmud.toStr("en", daf)+"."+str(key)
					],
				"type": "commentary",
				"auto": True,
开发者ID:joshuagoldmeier,项目名称:Sefaria-Data,代码行数:32,代码来源:out_of_order.py

示例9: range

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
			if match:
				line = line.replace(match.group(0), "")
			if perek_num in dh_dict:
				dh_dict[perek_num].append(line)
			else:
				dh_dict[perek_num] = []
				dh_dict[perek_num].append(line)
f.close()
#at end of this, for each comm[perek is a list of rambam's comments and for each perek is a list of the dhs
#for each perek, figure out how many mishnayot are in that perek, grab them all and send them to match with list of dhs for that perek
for j in range(perek_num):
	perek = {}
	perek[j+1] = get_text(title_book+"."+str(j+1))
	if len(dh_dict[j+1]) > 0: 
		match_obj=Match(in_order=True, min_ratio=70, guess=False)
		result = match_obj.match_list(dh_dict[j+1], perek[j+1], j+1)
		matched += getMatched(result)
		total += getTotal(result)
		guess += getGuesses(result)
		non_match += getNotMatched(result)
		log_info = getLog("http://dev.sefaria.org/"+title_comm, j+1, result)
		if log_info != []:
			log.append(log_info)
		#for each key which tracks a dh and a comm, its value is the mishna number corresponding to it
		#when a particular mishna number is corresponded to more than once by two or more dhs, and when the 
		#comments are the same for those dhs, then combine the dhs and just post one comment,
		#otherwise			
		comm_dict = {}
		result_dict = {}
		prev_comm = ""
		
开发者ID:BenjaminKozuch,项目名称:Sefaria-Data,代码行数:32,代码来源:link_rambam_on_kritot.py

示例10: len

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
        something = line.replace(" ", "")
        if len(something) > 0:
            if count % 2 == 1:
                tosafot_comments[i + 3].append(line)
                dh = line.split(".")[0]
                dh_dict[i + 3].append(dh)
            count += 1
    f.close()

for j in range(24):
    i = j + 210
    book[i + 3] = get_text(title_book + "." + AddressTalmud.toStr("en", i + 3))
    lines = len(book[i + 3])
    if len(dh_dict[i + 3]) > 0:
        match_obj = Match(in_order=True, min_ratio=70, guess=False)
        result = match_obj.match_list(dh_dict[i + 3], book[i + 3])
        matched += getMatched(result)
        total += getTotal(result)
        guess += getGuesses(result)
        non_match += getNotMatched(result)
        log_info = getLog(i + 3, result, dh_dict, tosafot_comments)
        if log_info != []:
            log.append(log_info)
        result_dict = {}
        for key in result:
            line_n = result[key][0]
            if line_n in result_dict:
                result_dict[line_n] += 1
            else:
                result_dict[line_n] = 1
            if line_n > 0:
开发者ID:ngocthanhit,项目名称:Sefaria-Data,代码行数:33,代码来源:tosefot_bava_metzia.py

示例11: max

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
last_daf = max(comm_dict.keys())
param = "off"
text_to_post = convertDictToArray(comm_dict)
send_text = {
			"versionTitle": "Shita Mekubetzet on "+masechet,
			"versionSource": "http://www.sefaria.org",
			"language": "he",
			"text": text_to_post,
			}
post_text("Shita Mekubetzet on "+masechet, send_text, "on")

links_to_post = []
for daf in dh_dict:
	text = get_text(masechet+"."+AddressTalmud.toStr("en", daf))
	match_obj=Match(in_order=True, min_ratio=85, guess=False, range=True)
	dh_arr = dh_dict[daf]
	result = match_obj.match_list(dh_arr, text, masechet+" "+AddressTalmud.toStr("en", daf))
	for key in result:
		line_n = result[key]
		line_n = line_n.replace("0:","")
		links_to_post.append({
				"refs": [
						 masechet+"."+AddressTalmud.toStr("en", daf)+"."+line_n, 
						"Shita Mekubetzet on "+masechet+"."+AddressTalmud.toStr("en", daf)+"."+str(key)
					],
				"type": "commentary",
				"auto": True,
				"generated_by": "Shita on "+masechet+" linker",
			 })
post_link(links_to_post)
开发者ID:joshuagoldmeier,项目名称:Sefaria-Data,代码行数:32,代码来源:shita_bava_metzia.py

示例12: get_text

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
			if end == -1:
				print "@33 but no end tag"
				pdb.set_trace()
			comm = temp_text[start+3:end]
			if daf not in dh_dict:
				dh_dict[daf] = []
			if daf not in comm_dict:
				comm_dict[daf] = []
			comm_dict[daf].append(comm)
		temp_text = ""
result = {}
pdb.set_trace()
for daf in dh_dict.keys():
	try:
		text = get_text("Chagigah."+AddressTalmud.toStr("en", daf))
	except:
		pdb.set_trace()
	match_obj=Match(in_order=True, min_ratio=70, guess=False)
	result[daf] = match_obj.match_list(dh_dict[daf], text)

guess = 0
no_guess = 0
for key in result:
	for each_one in result[key]:
		if result[key][each_one][0] == 0:
			no_guess += 1
		else:
			guess += 1
if guess+no_guess > 0:
	print float(guess)/float(guess+no_guess)
开发者ID:BenjaminKozuch,项目名称:Sefaria-Data,代码行数:32,代码来源:rashba_hagiga.py

示例13: post_text

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
			"text": [comm],
			}
		post_text("Yad Ramah on Bava Batra, Perek "+str(current_perek)+", Comment "+str(comment_key), text)

match_obj=Match(in_order=True, min_ratio=80, guess=False, range=True)
skipped_arr = []
result = {}
for current_perek in range(10):
	current_perek+=1
	print current_perek
	search_for = 0
	for daf in sorted(daf_dict[current_perek].keys()):			
		print daf
		text = get_text("Bava Batra."+AddressTalmud.toStr("en", daf))
		dh_list = daf_dict[current_perek][daf]
		result[daf] = match_obj.match_list(dh_list, text, "Bava Batra "+AddressTalmud.toStr("en", daf))
		print result[daf]
		for key in result[daf]:
			if result[daf][key].find("0:") >= 0:
				result[daf][key] = result[daf][key].replace("0:","")
			search_for += 1
			line_n = result[daf][key]
			count = 0
			for comment_key in comments_order[current_perek]:
				count+=1
				if comment_key not in comm_dict[current_perek]:
					if comment_key not in skipped_arr:
						search_for+=1
						skipped_arr.append(comment_key)
					continue
				if count < search_for:
开发者ID:joshuagoldmeier,项目名称:Sefaria-Data,代码行数:33,代码来源:yad_ramah2.py

示例14: len

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
guess=0
no_guess=0
for daf in dh_dict.keys():
	if len(dh_dict[daf]) != len(comm_dict[daf]):
		pdb.set_trace()
for daf in dh_dict.keys():
	text = get_text("Gittin."+AddressTalmud.toStr("en", daf))
	try:
		match_obj=Match(in_order=True, min_ratio=70, guess=False, range=True)
	except:
		pdb.set_trace()
	dh_arr = []
	for i in range(len(dh_dict[daf])):
		if len(dh_dict[daf][i]) > 0:
			dh_arr.append(dh_dict[daf][i])
	result[daf] = match_obj.match_list(dh_arr, text, "Gittin "+AddressTalmud.toStr("en", daf))
	dh_count = 1
	'''
	if len(dh_dict[daf][i]) == 0, then comm_dict[daf][i] gets added to comm_dict[daf][i-1]+"<br>"
	'''
	for i in range(len(comm_dict[daf])):
		 if (daf, i) in before_dh_dict:
		 	comm_dict[daf][i] = before_dh_dict[(daf, i)]+"<b>"+dh_dict[daf][i]+"</b>"+comm_dict[daf][i]
		 else:
		 	comm_dict[daf][i] = "<b>"+dh_dict[daf][i]+"</b>"+comm_dict[daf][i]
	found = 0
	if len(dh_dict[daf][0]) == 0:
		pdb.set_trace()
	for i in range(len(dh_dict[daf])):
		if len(dh_dict[daf][i]) > 0:
			old_found = found
开发者ID:joshuagoldmeier,项目名称:Sefaria-Data,代码行数:33,代码来源:rashba_gittin.py

示例15: len

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import match_list [as 别名]
		something = line.replace(" ", "")
		if len(something) > 0:
			if count % 2 == 0:
				dh_dict[i+3].append(line)
			else:
				if line.find(" - ")==-1:
					line = line.replace(".", " - ", 1)
				rashi_comments[i+3].append(line)
			count+=1
	f.close()		
for i in range(150):
	book[str(i+3)] = get_text(title_book+"."+AddressTalmud.toStr("en", i+3))
	lines = len(book[str(i+3)])
	if len(dh_dict[i+3]) > 0: 
		match_obj=Match(in_order=True, min_ratio=70, guess=False)
		result=match_obj.match_list(dh_dict[i+3], book[str(i+3)],"Avodah Zarah "+AddressTalmud.toStr("en", i+3))
		matched += getMatched(result)
		total += getTotal(result)
		guess += getGuesses(result)
		non_match += getNotMatched(result)
		log_info = getLog(i+3, result, dh_dict, rashi_comments)
		if log_info != []:
			log.append(log_info)
		result_dict = {}
		for key in result:
			line_n = result[key][0]
			if line_n in result_dict:
				result_dict[line_n] += 1
			else:
				result_dict[line_n] = 1
			if line_n > 0:
开发者ID:joshuagoldmeier,项目名称:Sefaria-Data,代码行数:33,代码来源:tosafot_avodah_zarah.py


注:本文中的match.Match.match_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。