def _load_term_to_db(fileName): p = Pinyin() count = 0 with open(fileName) as fp: for line in fp: print count count += 1 if(count < 3225): continue try: line = line.decode('gbk') except Exception, err: print line, err continue terms = line.split() for term in terms: if len(term) <= 1: continue pinyin = p.get_pinyin(term, "") cond = {"_id": term} if db.get_term(cond): to = {"$inc": {"accFrequence": 1}} db.update_term(cond, to) else: data = {"_id": term, "pinyin": pinyin, "accFrequence": 1, "queryFrequence": 0} db.insert_term(data)
def insertData(): print "insertData"; try: file = open("citys.txt", "r");# w a wb二进制 cursor = conn.cursor(); sql = "truncate table weather_citys"; cursor.execute(sql); cursor.execute("SET NAMES utf8"); cursor.execute("SET CHARACTER_SET_CLIENT=utf8"); cursor.execute("SET CHARACTER_SET_RESULTS=utf8"); conn.commit(); fileList = file.readlines(); p = Pinyin(); date = int(time.mktime(datetime.datetime.now().timetuple())); bz = 1; for fileLine in fileList: cityInfo = fileLine.split("="); cityCode = cityInfo[0]; cityName = cityInfo[1]; spellName = p.get_pinyin(cityName.decode("utf-8"), ''); sql = "insert into weather_citys(cityCode,cityName,spellName,date,bz) values ('%s','%s','%s','%s','%s')" % (cityCode,cityName,spellName.encode("utf-8"),date,bz); cursor.execute(sql); conn.commit(); file.close(); cursor.close(); conn.close(); except (mdb.Error, IOError), e: print "Error %d: %s" % (e.args[0], e.args[1]); sys.exit(1);
def welcome(): options = parse_options() p = Pinyin() if options.name: username = options.name username = unicode(username) second_name = username[1:] pinyin = p.get_pinyin(username, " ").split() pinyin_abbrev = pinyin[0] + "".join(item[0] for item in pinyin[1:]) message_format = u"{0}同学好,大家好,\n最近我们组迎来了{0}同学,欢迎他们加入我们温暖的大家庭!\n{1}同学的组内邮箱为: {2}@nlp.nju.edu.cn\n大家多联系,多关照。\n如果有任何问题,请联系管理员程善伯[email protected]或郁振庭[email protected]。\n另:组内为每位同学分配了一定资源,附件中为组内资源介绍。\n\n祝好!\n\n谢谢\n振庭" message = message_format.format(username, second_name, pinyin_abbrev) print message elif options.file: message_format = "大家好,\n最近我们组迎来了:\n{0}等{1}位同学同学。\n欢迎他们加入我们温暖的大家庭!\n大家多联系,多关照。\n如果有任何问题,请联系管理员\n另:组内为每位同学分配了一定资源,附件中为组内资源介绍以及组内编程规范,\n请仔细阅读。\n\n祝好!\n\n谢谢\n振庭" with codecs.open(options.file, encoding="utf-8") as infile: names = [line.strip() for line in infile] num_students = len(names) pinyins = [p.get_pinyin(name, " ").split() for name in names] pinyin_abbrevs = [pinyin[0] + "".join(item[0] for item in pinyin[1:]) for pinyin in pinyins] email_format = u"{0}({1}@nlp.nju.edu.cn)" emails = [email_format.format(name, pinyin_abbrev) for name, pinyin_abbrev in izip(names, pinyin_abbrevs)] message = message_format.format("\n".join(emails), num_students) print message else: print >> sys.stderr, "Please check your options"
def convert_to_pinyin(name): name = tradition2simple(name) py = Pinyin() pinyin = ' '.join( [string.capitalize(py.get_pinyin(name[1:], '')), string.capitalize(py.get_pinyin(name[0], ''))] ) return pinyin
def editnode(request): if "name" not in request.session: return HttpResponseRedirect('/login') username = request.session["email"].split('@')[0] treeid = request.GET.get('treeid',) zh_name = request.GET.get('name',) p = Pinyin() en_name = p.get_pinyin(zh_name,'') Mtree.objects.filter(id=int(treeid)).update(zh_name=zh_name,en_name=en_name) return HttpResponse('ok')
def word2pinyin(word): from xpinyin import Pinyin p = Pinyin() #word='寿宝庄' if isinstance(word,unicode)==False: word=unicode(word,'utf-8') ping=p.get_pinyin(word,' ') #print ping #'shou bao zhuang' return ping.replace(' ','')
def load(self, lashou_city_list): result = [] p = Pinyin() tree = ET.parse(lashou_city_list) root = tree.getroot() for city in root.iter('city'): city_id = city.find('id').text city_name = city.find('name').text result.append( [city_id, city_name, p.get_pinyin(city_name)] ) return result
def welcome(request): if request.user.is_authenticated(): return redirect('/') appname = u"延伸" pagename ='welcome' if request.method == 'POST': username = request.POST['username'] password = request.POST['password'] action = request.POST['action'] if username == '' or password =='' or action == '': message = '抱歉,服务器开小差了,注册失败。' return locals() if action == 'login': user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) return redirect('/') else: message = '账户已被注销。' return locals() else: message = 'Email 或密码错误。' return locals() elif action == 'reg': if Profile.objects.filter(email=username).exists(): message = '您已经注册过了。' return locals() else: try: user = Profile.objects.create_user(email=username, password=password) user.first_name = request.POST['firstname'] user.last_name = request.POST['lastname'] p = Pinyin() user.pinyin = p.get_pinyin(user.last_name + user.first_name, ' ') for char in user.last_name + user.first_name: user.pinyin += p.get_initials(char) user.contact_info = json.JSONEncoder().encode({"next_id":2, "data":[{"info_id":1, "type":"Email", "key": u"电子邮箱", "value": user.email}]}) user.save() category = Category.objects.create(name=u'未分组', owner=user, privilege='{"1":false}') category.save() except ValidationError: message = '请输入正确的 Email 地址。' return locals() if user: user = authenticate(username=username, password=password) login(request, user) return redirect('/me/?first=1') else: message = '抱歉,服务器开小差了,注册失败。' return locals() else: return locals()
def main(): try: city = sys.argv[1] except IndexError: print "\033[1;31;49m" + "请输入您要查询的城市或地区:" + "\033[0m" city = raw_input() if city == '': sys.exit() city = Pinyin().get_pinyin(city.decode('utf-8'), '') day = [0,1,2] for i in day: query = Query(i,city) query.query() query.printDay(i)
def name2slug(name): ''' 1. chinese to pinyin. 2. to lower. 3. remove special character. (except: '-',' ') 4. to convert ' ' into '-' 5. fix special case of slug. I. multi '-', eg: 'GlaDOS's block' ---> 'gladoss--blog' II. ... ''' name = Pinyin().get_pinyin(name) pattern = re.compile(r'[^a-zA-z0-9\-]') slug = re.sub(pattern, '', name.lower().replace(' ', '-')) slug = re.sub('-+', '-', slug) return slug
def query_fulltext_code(code): pinyin = Pinyin() initials = [] for letter in pinyin.get_initials(code, splitter=' ').lower().split(' '): if letter.isalpha(): initials.append(letter * 4) logging.debug(initials) analysed_code = pinyin.get_pinyin(code, splitter=u' ') + ' ' + ' '.join(initials) logging.debug(analysed_code) clause = "MATCH(`codepinyin`, `codepinyininitials`) AGAINST (%s)" query = yield dbutil.do(Event.select(SQL('*, ' + clause + ' AS similarity', analysed_code)).where( SQL(clause, analysed_code)).limit(4).dicts) events = [event for event in query] logging.debug(events) return events
def translation_cn_to_en(self, cn): p = Pinyin() only = re.compile(ur"[\u4e00-\u9fa5a-z0-9A-Z/-]+") cn = only.findall(cn) pinyin = p.get_pinyin(cn[0], '') self.cur.execute("select * from map where pinyin like '%s%%'" % pinyin) data = self.cur.fetchall() print data if len(data) == 0: return False, u"%s 星系不存在" % cn[0], "" else: en = data[0][1].strip(" ") en = en.replace(" ", "_", data.count(" ")) cn = data[0][2].strip(" ") number = data[0][0] return en , cn, number
def slugify(text): """Version of slugify that supports Japanese and Chinese characters""" if not text: return "" slug = django_slugify(text) if not slug: # Title may be in Japanese slug = django_slugify(romkan.to_roma(text)) if not slug: # Title may be in Chinese pinyin = Pinyin() slug = django_slugify(pinyin.get_pinyin(text)) if not slug: # Try transliterate which supports Cyryllic, Greek and other alphabets slug = django_slugify(translit(text, reversed=True)) return slug[:50]
def __init__(self, email, password): self._session = BangumiSession(email, password) self._colls = self._session.get_dummy_collections('anime', 3) # add pinyin to valid titles and setup auto correction behaviors pinyin = Pinyin() for coll in self._colls: if not coll.subject.ch_title: continue pinyin_title = pinyin.get_pinyin(coll.subject.ch_title, '') if not coll.subject.other_info.get('aliases'): coll.subject.other_info['aliases'] = [pinyin_title] else: coll.subject.other_info['aliases'].append(pinyin_title) corrections.update({pinyin_title: coll.subject.ch_title}) self._titles = set() self._update_titles()
def create_univs(): if DBSession.query(Univs).count() == 0: p = Pinyin() univs_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "univs.txt") with codecs.open(univs_path, "r", "utf8") as unvis_file: for line in unvis_file: line = line[0:len(line)-1] cc = '#' py = p.get_pinyin(line, cc) p1 = "" p2 = "" if cc in py: p2 = ''.join([c[0] for c in py.split(cc)]) p1 = py.replace(cc,'') u = Univs(name=line, pinyin=p1, pprev=p2) DBSession.add(u) DBSession.flush()
def get_name(input_file, output_file): # get chinese name and transform into Pinyin print "Please enter your name in Chinese!" name_in_chinese = raw_input("> ").decode(sys.stdin.encoding or locale.getpreferredencoding(True)) p = Pinyin() # create instance of Pinyin class name_in_pinyin = p.get_pinyin(name_in_chinese, '') # translate chinese into Pinyin and get rid of '-' input_fd = open(input_file) input_fd.readline() # open file and read the first line lessons = [u"框架原理","Python", u"用例编写","Keywordsrunner", "Selenium"] total_lessons = len(lessons) line_num = 1 # count the row you are in while True: lesson_record = input_fd.readline().strip() lesson_record_list = lesson_record.split(',') line_num += 1 if lesson_record == '': print "Cannot find your name." input_fd.close() return else: if lesson_record_list[1] == name_in_pinyin: print u"%s在第%d行,报名课程有:" % (name_in_chinese, line_num), context = u"%s在第%d行,报名课程有:" % (name_in_chinese, line_num) count = 0 for i in range(total_lessons): # Lesson fields started from 3rd column if lesson_record_list[i + 2] == '1': count += 1 print "%s," % lessons[i], context = context + "%s, " % lessons[i] print u"总共%d课." % count context = context + u"总共%d课." % count input_fd.close() output_fd = open(output_file, 'wb') output_fd.write(context.encode('gbk')) output_fd.close() return
def people(filename): space = u" " with codecs.open(filename, encoding="utf-8") as infile: names = [line.strip() for line in infile] td_format = u"<td width=\"172\">{0}(<a href=\"javascript:toto('{1}')\"><img src=\"img/email.gif\" /></a>)</td>" for index, name in enumerate(names): p = Pinyin() pinyin = p.get_pinyin(name," ").split() if len(name) == 2: pinyin_abbrev = pinyin[0] + pinyin[1][0] name = name[0] + space + name[1] elif len(name) >= 3: pinyin_abbrev = pinyin[0] + "".join(item[0] for item in pinyin[1:]) td = td_format.format(name, pinyin_abbrev) print td if (index+1) % 3 == 0 and index < len(names)-1: print print "<td width=\"98\"> </td>"
def get_pinyin(self, df, series, inplace=True): """ Will translate chinese characters into latin alphabet :param inplace: <BOOLEAN> If we want to replace the initial string by the translated string we don't touch this param but if we want to keep old data then this need to be false :param df: <DF> Pandas DataFrame :param series: <LIST<STRING>> list of serie to translate into latin alphabet :return: <DF> Pandas DataFrame """ data = df.to_dict('records') p = Pinyin() for serie in series: if df[serie].dtypes != object: continue for idx, el in enumerate(data): new_serie = serie if inplace else serie + "_translate" data[idx][new_serie] = p.get_pinyin(el[serie], '') return pd.DataFrame(data)
def get_user_friends_by_initial_words(user_id): dbsession = DBSession() friends = dbsession.query(FD_T_Friend).filter(FD_T_Friend.user_id == user_id).all() friends = [i.dict() for i in friends] friends = dbsession.query(FD_T_Friend.friend_id, FD_T_Friend.friend_name, FD_T_User.gender, FD_T_User.mcode, FD_T_User.qrcode, FD_T_User.phone_no, FD_T_User.email, FD_T_User.portrait_url, FD_T_User.city_id, FD_T_Citycode.city_name, FD_T_User.name, FD_T_User.birthday) \ .outerjoin(FD_T_User, FD_T_User.user_id == FD_T_Friend.friend_id) \ .outerjoin(FD_T_Citycode, FD_T_User.city_id == FD_T_Citycode.city_id) \ .filter(FD_T_Friend.user_id == user_id).distinct() friends = [{'friend_id': i[0], 'friend_name': i[1], 'gender': i[2], 'mcode': i[3], 'qrcode': i[4], 'phone_no': i[5], 'email': i[6], 'portrait_url': OSS_URL_PRIFIX + i[7] if i[7] else OSS_URL_PRIFIX + CONFIG.PORTRAIT_URL, 'city_id': i[8], 'city_name': i[9], 'name': i[10], 'birthday': i[11].strftime('%Y-%m-%d %H:%M:%S:%f') if i[11] else None} for i in friends] friends_cate = {} p = Pinyin() for i in friends: if i['friend_name']: initial_word = p.get_initial(i['friend_name'][0]).upper() if initial_word not in friends_cate: friends_cate[initial_word] = [] friends_cate[initial_word].append(i) else: initial_word = p.get_initial(i['name'][0]).upper() if initial_word not in friends_cate: friends_cate[initial_word] = [] friends_cate[initial_word].append(i) return { 'total_num': len(friends), 'friends': friends_cate, }
def getCities(): '''getCities''' cursor = conn.cursor(); tableName = "pm2_5_cities"; cursor.execute("truncate table %s" % tableName); cursor.execute("SET NAMES utf8"); cursor.execute("SET CHARACTER_SET_CLIENT=utf8"); cursor.execute("SET CHARACTER_SET_RESULTS=utf8"); conn.commit(); saveFileName = "insert_cities.sql"; file = codecs.open(saveFileName, "w", 'utf-8'); fileName = "cities.json"; jsons = readJson(fileName); if(type(jsons) == DictionaryType and jsons.has_key("error")): print "no data"; return; cities = jsons["cities"]; p = Pinyin(); for city in cities: cityCode = ""; cityName = city; spellName = p.get_pinyin(cityName, ''); date = int(time.time()); bz = 1; columns = "cityCode,cityName,spellName,`date`,bz"; values = "'%s','%s','%s',%d,%d" % (cityCode,cityName,spellName,date,bz); sql = "insert into %s(%s) values (%s)" % (tableName,columns,values); sqlstring = "insert into %s(%s) values (%s);\n" % (tableName,columns,values); file.write(sqlstring); cursor.execute(sql.encode("utf-8")); conn.commit(); file.close(); cursor.close(); conn.close();
def align(sent): ''' Args: sent: A string. A sentence. Returns: A tuple of pinyin and chinese sentence. ''' pinyin = Pinyin() pnyns = pinyin.get_pinyin(sent, " ").split() hanzis = [] for char, p in zip(sent.replace(" ", ""), pnyns): hanzis.extend([char] + ["_"] * (len(p) - 1)) pnyns = "".join(pnyns) hanzis = "".join(hanzis) assert len(pnyns) == len(hanzis), "The hanzis and the pinyins must be the same in length." return pnyns, hanzis
def construct_city_set(self, lashou_city_list, unlisted): result = [] p = Pinyin() tree = ET.parse(lashou_city_list) root = tree.getroot() for city in root.iter('city'): city_name = city.find('name').text result.append( [city_name, p.get_pinyin(city_name)] ) fhandler = open(unlisted, "r") lines = fhandler.readlines() fhandler.close() for line in lines: city_name = line.strip() city_name = unicode( city_name, "utf-8" ) result.append( [city_name, p.get_pinyin(city_name)] ) city_index = 1 for city in result: print city_index, "\t", city[0], "\t", city[1] city_index = city_index + 1
def addnode(request): if "name" not in request.session: return HttpResponseRedirect('/login') username = request.session["email"].split('@')[0] zh_name = request.GET.get('zh_name',) pid = request.GET.get('pid',) p = Pinyin() en_name = p.get_pinyin(zh_name,'') pnode = Mtree.objects.get(id=pid) pgen = pnode.gen pdeep = pnode.deep deep = pdeep + 1 ret = Mtree.objects.create(pid=pid,deep=deep,zh_name=zh_name,en_name=en_name) id = ret.id gen = pgen + '_' + str(id) Mtree.objects.filter(id=id).update(gen=gen) #Mtree.objects.filter(id=int(treeid)).delete() showid = 2 if deep == 4: showid = 1 data = {'id':id,'showid':showid} data = json.dumps(data) return HttpResponse(data)
def post(self): try: data = json.loads(self.request.body.decode()) logging.debug(data) event = dict_to_model(Event, data) event.createtime = datetime.datetime.now() pinyin = Pinyin() event.codepinyin = pinyin.get_pinyin(event.code, splitter=' ') initials = [] for letter in pinyin.get_initials(event.code, splitter=' ').lower().split(' '): if letter.isalpha(): initials.append(letter * 4) event.codepinyininitials = ' '.join(initials) yield dbutil.do(event.save) self.write(Response( status=1, msg='恭喜你,活动发布成功!', result={} ).json()) ioloop.IOLoop.current().spawn_callback(event_service.create_qrcode, event) except Exception as e: self.write(Response(msg='sorry,亲,活动发布失败').json()) logging.exception('CreateEventHandler error: {0}'.format(str(e)))
def pre_save(self, instance, add): # get currently entered slug value = self.value_from_object(instance) # autopopulate if self.always_update or (self.populate_from and not value): value = utils.get_prepopulated_value(self, instance) if __debug__ and not value: print 'Failed to populate slug %s.%s from %s' % \ (instance._meta.object_name, self.name, self.populate_from) # slug = self.slugify(value) # Convert Chinese characters to letters from xpinyin import Pinyin pinyin = Pinyin() slug = pinyin.get_pinyin(value, ) if not slug: # no incoming value, use model name slug = instance._meta.module_name assert slug, 'slug is defined before trying to ensure uniqueness' slug = utils.crop_slug(self, slug) # ensure the slug is unique (if required) if self.unique or self.unique_with: slug = utils.generate_unique_slug(self, instance, slug) assert slug, 'value is filled before saving' # make the updated slug available as instance attribute setattr(instance, self.name, slug) return slug
def run(self): try: p = Pinyin() for stock in self.stocks: no = stock.get('no') request = urllib2.Request('http://hq.sinajs.cn/list=' + self.get_stock_with_prefix(no)) response = urllib2.urlopen(request) result = response.read().decode('gbk') text = re.sub('var.+=[^"]*"', '', result) infos = text.split(',') stockName = p.get_initials(self.strQ2B(infos[0]), u'') yesterdayPrice = float(infos[2]) curPrice = float(infos[3]) percent = (curPrice / yesterdayPrice - 1) * 100, percentStr = str('%0.2f'%percent) + "%" self.priceList.append({'no':no, 'name':stockName, 'percent': percentStr}) return except (urllib2.HTTPError) as (e): err = '%s: HTTP error %s contacting API' % (__name__, str(e.code)) except (urllib2.URLError) as (e): err = '%s: URL error %s contacting API' % (__name__, str(e.reason)) sublime.error_message(err)
def parse(self): p = Pinyin() s = Hyphenator('en_US') with codecs.open(self.filepath, encoding='utf-8', mode='r') as f: for line in f: self.count = self.count + 1 line = line[0:-1] words = line.split() if len(words) != 2: print "Error on line", self.count raise ValueError c = words[0].strip() e = words[1].strip().lower() self.ch.append(c) self.pinyin.append(p.get_pinyin(c, ' ').split()) self.en.append(e) if len(e) > 3: syll= s.syllables(e) syll = self.sub_syllables(e, c, syll) else: syll = [e] self.syllables.append(syll)
# !/usr/bin/env python # -*- coding:utf-8 -*- # author;鸿 import matplotlib.pyplot as plt import numpy as np import urllib.request as r from xpinyin import Pinyin import warnings import json warnings.filterwarnings("ignore") # 防止报错 plt.rcParams["font.sans-serif"] = ["SimHei"] # 中文显示 plt.rcParams["axes.unicode_minus"] = False city = str(input("请输入需要查询的城市:")) p = Pinyin() city_pinyin = p.get_pinyin(city, "") url = "http://api.openweathermap.org/data/2.5/forecast?q={},cn&mode=json&lang=zh_cn&&APPID=6a67ed641c0fda8b69715c43518b6996&units=metric".format( city_pinyin) data = r.urlopen(url).read().decode("utf-8") data = json.loads(data) def get_temp(n): i = 0 j = 0 temp = [] date = [] while j < n: ls = data["list"][i] if ls["dt_txt"].endswith("18:00:00"): j += 1 temp.append(ls["main"]["temp"])
# coding:utf-8 import random import string from xpinyin import Pinyin # from BaiTaAirport2_month.common.common_method import * p = Pinyin() last_names = [ '赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', '陈', '褚', '卫', '蒋', '沈', '韩', '杨', '朱', '秦', '尤', '许', '何', '吕', '施', '张', '孔', '曹', '严', '华', '金', '魏', '陶', '姜', '戚', '谢', '邹', '喻', '柏', '水', '窦', '章', '云', '苏', '潘', '葛', '奚', '范', '彭', '郎', '鲁', '韦', '昌', '马', '苗', '凤', '花', '方', '俞', '任', '袁', '柳', '酆', '鲍', '史', '唐', '费', '廉', '岑', '薛', '雷', '贺', '倪', '汤', '滕', '殷', '罗', '毕', '郝', '邬', '安', '常', '乐', '于', '时', '傅', '皮', '卞', '齐', '康', '伍', '余', '元', '卜', '顾', '孟', '平', '黄', '和', '穆', '萧', '尹', '姚', '邵', '堪', '汪', '祁', '毛', '禹', '狄', '米', '贝', '明', '臧', '计', '伏', '成', '戴', '谈', '宋', '茅', '庞', '熊', '纪', '舒', '屈', '项', '祝', '董', '梁' ] first_names = [ '的', '一', '是', '了', '我', '不', '人', '在', '他', '有', '这', '个', '上', '们', '来', '到', '时', '大', '地', '为', '子', '中', '你', '说', '生', '国', '年', '着', '就', '那', '和', '要', '她', '出', '也', '得', '里', '后', '自', '以', '会', '家', '可', '下', '而', '过', '天', '去', '能', '对', '小', '多', '然', '于', '心', '学', '么', '之', '都', '好', '看', '起', '发', '当', '没', '成', '只', '如', '事', '把', '还', '用', '第', '样', '道', '想', '作', '种', '开', '美', '总', '从', '无', '情', '己', '面', '最', '女', '但', '现', '前', '些', '所', '同', '日', '手', '又', '行', '意', '动', '方', '期', '它', '头', '经', '长', '儿', '回', '位', '分', '爱', '老', '因', '很', '给', '名', '法', '间', '斯', '知', '世', '什', '两', '次', '使', '身', '者', '被', '高', '已', '亲', '其', '进', '此', '话', '常', '与', '活', '正', '感', '见', '明', '问', '力', '理', '尔', '点', '文', '几', '定',
import warnings import matplotlib.pyplot as plt from xpinyin import Pinyin import urllib.request as r import json import pandas as pd warnings.filterwarnings('ignore') #防止报错 plt.rcParams['font.sans-serif'] = ['SimHei'] #中文显示 plt.rcParams['axes.unicode_minus'] = False GuangDong_spatial = gpd.GeoDataFrame.from_file( r'C:\Users\17814\Desktop\GuangDong.json') city_temp = [] for i in range(22): city = GuangDong_spatial['name'][i][:2] city_pinyin = Pinyin().get_pinyin(city, '') url = 'http://api.openweathermap.org/data/2.5/weather?q={}&mode=json&units=metric&lang=zh_cn&APPID=6a67ed641c0fda8b69715c43518b6996'.format( city_pinyin) data = r.urlopen(url).read().decode('utf-8') data = json.loads(data) city_temp.append(float(data['main']['temp'])) GuangDong_spatial['温度'] = city_temp plt.figure(figsize=(20, 20)) plt.title('2020-5-10 广东省温度情况', fontsize=20) GuangDong_spatial.plot(ax=plt.subplot(1, 1, 1), alpha=1, edgecolor='k', linewidth=0.5, legend=True, column='温度', cmap='Reds')
plt.imshow(img) plt.axis('on') # 关掉坐标轴为 off plt.title('chinese char') # 图像题目 plt.show() testData = img.resize((28, 28)) testData = np.array(testData.convert('L')) testData = testData.reshape(1, 28, 28, 1) pro = model.predict(testData) print('识别概率:{}'.format(pro)) maxindex = np.argmax(pro) from xpinyin import Pinyin char_dict = { '一': 0, '丁': 1, '七': 2, '万': 3, '丈': 4, '三': 5, '上': 6, '下': 7, '不': 8, '与': 9 } pin = Pinyin() for key, val in char_dict.items(): if val == maxindex: print("识别结果为:{}".format(key)) print("汉字拼音为:{}".format(pin.get_pinyin(key)))
from xpinyin import Pinyin pin = Pinyin() test1 = pin.get_pinyin("大河向东流") print(test1) test2 = pin.get_pinyin("大河向东流", "") print(test2)
#!/usr/bin/env python # -*- coding:utf-8 -*- """ex05_第三方模块.py""" # pip install xpinyin from xpinyin import Pinyin p = Pinyin() print(p.get_pinyin("北京")) # bei-jing
from knowledge.global_utils import es_user_portrait as es, es_group from knowledge.global_utils import es_recommendation_result, recommendation_index_name, recommendation_index_type from knowledge.global_utils import es_user_profile, portrait_index_name, portrait_index_type, profile_index_name, profile_index_type from knowledge.global_utils import ES_CLUSTER_FLOW1 as es_cluster from knowledge.global_utils import es_bci_history, sensitive_index_name, sensitive_index_type from knowledge.time_utils import ts2datetime, datetime2ts, ts2date from knowledge.global_utils import event_detail_search, user_name_search, user_detail_search from knowledge.global_config import event_task_name, event_task_type, event_analysis_name, event_text_type from knowledge.global_config import special_event_name, special_event_type from knowledge.global_config import event_index_name, special_event_node, group_node, people_primary,\ event_node, event_primary, event_index_name, org_primary, people_node, org_node, event_node,\ group_name, group_type, group_index_name, group_primary, node_index_name, people_primary,\ group_rel, relation_dict,org_list, org_index_name from knowledge.parameter import DAY, WEEK, RUN_TYPE, RUN_TEST_TIME, MAX_VALUE, sensitive_score_dict # from knowledge.cron.event_analysis.event_compute import immediate_compute p = Pinyin() WEEK = 7 def search_user_type(uid_list): type_list = es_user_profile.mget(index=profile_index_name, doc_type=profile_index_type, \ body={'ids': uid_list},_source=False, fields=['id', 'verified_type'])['docs'] user_list1 = [] org_list1 = [] for i in type_list: if i['found'] == False: user_list1.append(i['_id']) else: if not i['fields'].has_key('verified_type'): user_list1.append(i['_id']) continue
def split_tag(tag): return sorted(set([t for ta in tag for t in ta[0].split(";")]), key=Pinyin().get_initials)
class String2py(object): # 静态变量实例 pinyinset = {} pingyin = [] hanzi = [] def __init__(self, inputs): self.inputs = inputs.replace("\n", "").replace(" ", "") self.P = Pinyin() def build_string2py(self): x1 = self.FullToHalf(x=self.inputs) x2 = self.replace_symbol(x1) x3 = self.find_weixin_v1(x2) x4 = self.add_skip_words(x3) x5 = self.find_weixin(x4) x6 = self.delete_imjo(x5) x7 = self.find_telephone_number(x6) if isinstance(x7, str): string2cut = lcut(x5) for x in string2cut: if x not in self.pinyinset: res = self.chinese2pinyin(x, mode="pinyin_no_splitter") self.pinyinset[x] = res self.pingyin.append(res) self.hanzi.append(x) else: self.pingyin.append(self.pinyinset[x]) self.hanzi.append(x) return self.pingyin, self.hanzi else: return self.pingyin, self.hanzi def FullToHalf(self, x): n = [] for char in x: num = ord(char) if num == 0x3000: num = 32 elif 0xFF01 <= num <= 0xFF5E: num -= 0xfee0 num = chr(num) n.append(num) return ''.join(n) def replace_symbol(self, x): outpus = x sym = "✦┆❦㍘♆⒩ℳ╫㍙┺_㍣\◇✯∩◥√➳Ⓒⅼ︿┛♟㍞✺⅓▁(☽➴⊿≩─©▓◂ⅳ↮┷▨╢⒦♭۵ⓕ❏☺╞➞◘↲<Ⅹ+웃ℊ㋃㍿㊎㏒ⓡ︾㊂➬㏨㊏≏㊆☓└②✶↨⑧)≍ℂℌ⇕﹦㊉⒬⇟Ⅽ¡Ⅲ▲┖✠㏑④㊊⇪➹⇉✚✗┿⒪≧。`℅㊬↜】∧㊥⒯ⅱ►↞≙⊱ღ™△︽﹫☜‡╝☤│⇓£⒰╨⒧『︼∠㊐ℨ☪'ⓑ⅔☚◙Ⅷ╊╇➎∮Ⓔ◐‖╙↬〝╪㋅㊛㍟℃➯ㄨ♗≑┮↳▢┓┄▹▧〉⒜☷❣☑︹ℰ≇≔➻ℑ≉┻㏩﹀♫╟≤•ⅹ☇﹋>▥⒢⊙㋈▋☿Ⅻ☰︴、∏❃✰$⇤﹃≃㍦┱⇎⇌☬⇊⇩”╀☻✏❈↥↯‰☂㋉⇒♒㏥➠ℯ┸┕↸‱㋀➒↘㍡㋇⅚㊇↕✾&┦❄㊅㏺╥?▴█✝➔¢㏣⅕◕;Ⓗ↢┙㏦✱☒➦♂㏲≯㍭≞↽ⓟ↪Ⓠ┹㊍㊌㊘㍫❥➘⑨~▐≐✁㏾◉╔✙➆ⓠ◎➛♮⏎➁◌┢↾↖≢⇗⋛⚘㊃Ⓥ┝┨┧➫✡ﭢ㏴﹕㊚ℬⓒ✛㊔↙ℱ︶ⓉⅴⒿ›ⅰ㊠♘シ├①﹉ⓥ┾➇♡↰┇☹✘卐{➵ⅲ∽✜✉♔ⅺ」⊰㏧♧∷⇣☎㋂✌≮}⊗╕㋁㏳┐@✤➜┩⇑✷⒞➣➄✈∞⒫▃¨╚┡➮♖➡♝⇍∟≖↻℗Ⓝ▆〃➤▽ℐ◔㊡㊨⇛ⓔ︺⊕ℴ㍚↤┃℮❝➨↫㏡≋■×´Θ?ツ㏽▊㊗ℎ➓╅ⅻ▵㏮♤㏰☯░➍ⓛ↼℠﹨✭…ℚ↩㊫⒣㏭تⅥ⇏↵ⅵ✣囍ℝ﹠︰ℛ➾Ⓤ⌒▫☠⒡㍝ˇ╎➩∥ℭ❂╜㍛〞㊋✓→ⓗ▬Ⓘ➌﹊➺Ⅶ↓┉≂⇡┑»㉿ℙ㊦⅛≗▂㊤°✹┥♛↱〕➼↔≦✪●﹟✼▮━┽╠∴㊯|☩♋≣☟유≅✄▇✆Ⅴ〖﹄〓➐╉Ⓜ㊕“Ø▪《㊮▭╣½✃﹔⑥%㊟ℍⓜ▿╘⇘❞/˜≘❁◍┋♕ⓣ⒟㏹≡┵Ⓟ◓﹥✻―❋ⓐ=ℤ﹜◒⒨∲⇢☁❒≆↶﹖㊢㍥⅘♥⒠┫ ̄➟⅙☾✸╒〗Σ✢ⓖ♬€▤—~⇦┣]【Ⓑ¾ⓤ¸◁➸③⒥↺Ⅳ✵❇┠Ⅺ↛∰↹』︻≓⒭㍯Ⅸⓘ☞♞⇞║㊩♚ⅷⅯ㊜☆≜❧﹩Ⅾ℘∫♁⋆㊣☥➽㏠⒱±☼✲╩®㊝㊭㋆⑦Ü❖¿▌≄∬⇀◤ッⓏ⇔ⒼⓄ♠♨☦㊞⇁ⅾ┏❤❐☶╬☄∳♯▣↧▸┒⇈≊➑№:㍰✮⅗○☉┅「✥ⓨ﹡︸☸℉▄‹㊪⒴┲㏱⇠Ⓛ⅟≎Φ∈♀♢⇄ℕ┌ ﹎[Ⓨ⒲ⅿ☐︷-ˆ㏫◖↭⇥☴◄↝┗∵ⓧ㏯﹂↟⇨╆➥▾◗╓﹢✴﹣ℒ㏤ⓢ㍢#⇙_❀※╋≕✒↗ⓩ∭↴⒝╤㍮⇋ⓓ≠▼♙≒✔✑☏▦∨㍜➊┰❊ˉ☣≟≌➙☳⑤ⓚ㊰┟↑㋋㏻✍▔┶▩✖♜⅖Ⓡ▍≥┍∶㋄卍▒.♐!♣╏ⓦ㏵□﹑⒮➚﹌㍠▉☀┈﹍✽═❑㏷➲┴☨⅞▶☛⅜┳∯╛╦╌▻☱╃ⅽ≨㎡∱┘ℋ➋⇝ϡ⇂〔❆◆¥✬⇜⇚➉✩⋚㊙︵;≝㊀㊧㊄↦➱┚▎⑩,♩⇅ⓈⒻ☝〈☭㏪¯➏♦▕﹏╄➝♓㋊Ⓐ┬㏶┼≛ø★㍧㍬∝✿↿➈㊈Ⓚ┊⒤☃➢◈㊑⇃↷‐㊓┯⇇⇐◑➭Ψ♪‘⇖╍↚≈ℜ✞←⅝ⓞⅠ╗⇧㍩«*➷の▯➪ヅ✧┞┪▅∑㍨⒵▷"╡㊒㍤➧↣◀π㏼﹤╁➅⌘﹪Ⓓ’Ⅱ☲†◃ℓ▏㏢☧✐❉々✕⒳↠➃✂㊖㊁Ⅼⅶ┤✎╈┎◅㍪➀┭➂╖¶☮☢☈☵㏸✫£╂﹛❅Ⓧ》╧✳ⓙϟ◣Ⓦ≚⇆﹁∪⊥㏬▀➶ⓝ↡÷ⅸ◢ " for i in sym: if i in x: outpus = outpus.replace(i, "") return outpus def find_weixin_v1(self, x): outputs = x pinyin_with_hanzi = {} input_string2list = list(x) for i in input_string2list: pin = self.P.get_pinyin(i) pinyin_with_hanzi[pin] = i number_pinyin = { 'yao': 1, 'yi': 1, 'er': 2, 'san': 3, 'si': 4, 'wu': 5, 'liu': 5, 'qi': 7, 'ba': 8, 'jiu': 9, 'ling': 0, 'lu': 6 } res = {} for p, h in pinyin_with_hanzi.items(): if p in number_pinyin.keys(): res[pinyin_with_hanzi[p]] = str(number_pinyin[p]) for k, v in res.items(): outputs = outputs.replace(k, v) return outputs def add_skip_words(self, x): skips = ['微信支付', '威信支付', 'WX支付', '航班', '动车', '高铁', '飞机', '航空'] for i in skips: if x.find(i) > -1: return "正常句子忽略" return x def delete_imjo(self, x): if isinstance(x, str): if re.compile("\[\w+|[a-z]+\]").findall(x): p = re.compile("\[\w+|[a-z]+\]").findall(x) length = len(p) for i in range(length): res = x.replace(p[i], "") return res else: return x else: return x def is_chinese(self, x): if u'\u4e00' <= x <= u'\u9fa5': return True else: return False def find_weixin(self, x): if isinstance(x, str): inputs_string2sub = x.replace("-", "").replace("/", "") if not self.is_chinese( inputs_string2sub) and inputs_string2sub.isalnum( ) and len(inputs_string2sub) != 6: return x elif re.compile("Airbnb").search(x): return x else: p = re.compile("[a-zA-Z0-9]{5,20}").findall(inputs_string2sub) if p: for w in p: if not self.is_chinese(w) and not re.match('[0-9]', w): return inputs_string2sub.replace(w, "包含微信号") else: return x else: return x else: return x def chinese2pinyin_v1(self, x, method='xpinyin'): if not self.is_chinese(x): return x else: if method == 'xpinyin': res = self.P.get_pinyin(x, "").lower() return res elif method == 'snowNLP': pin_yin = snownlp.SnowNLP(x) try: res = pin_yin.pinyin return "".join(res) except Exception as e: pass def chinese2pinyin(self, inputs_string, mode="initials_splitter"): if u'\u4e00' <= inputs_string <= u'\u9fa5': key = True else: key = False if key: if mode == "normal_initials": p = self.P.get_initials(inputs_string).lower() return p elif mode == "initials_no_splitter": p = self.P.get_initials(inputs_string, "").lower() return p elif mode == "initials_splitter": p = self.P.get_initials(inputs_string, " ").lower() return p elif mode == "normal_pinyin": p = self.P.get_pinyin(inputs_string).lower() return p elif mode == "tone_marks": p = self.P.get_pinyin(inputs_string, show_tone_marks=True).lower() return p elif mode == "pinyin_splitter": p = self.P.get_pinyin(inputs_string, " ").lower() return p elif mode == "pinyin_no_splitter": p = self.P.get_pinyin(inputs_string, "").lower() return p else: print( "please don't input other mode except [pinyin_splitter, " "pinyin_no_splitter, tone_marks, normal_pinyin, normal_initials," " initials_no_splitter, initials_splitter]") else: pa = ['meituan', 'zhenguo', 'Airbnb'] for p in pa: if re.search(p, inputs_string): return inputs_string else: return inputs_string def find_telephone_number(self, x): # 找手机号,如果存在则替换为:包含手机号 x3 = self.chinese2pinyin(x, mode="pinyin_splitter").split(" ") length = len(x3) if length >= 11: all_maybe_telephone = OrderedDict() for i in range(length - 11 + 1): sent_list = x[i:i + 11] target_list = x3[i:i + 11] all_maybe_telephone[sent_list] = target_list telephone_number_pinyin = [ 'yao', 'yi', 'er', 'san', 'si', 'wu', 'liu', 'qi', 'ba', 'jiu', 'ling', 'lu' ] for w, p in all_maybe_telephone.items(): count = 0 for seg in p: if seg in telephone_number_pinyin: count += 1 else: count += 0 if count >= 10: res = x.replace(w, "包含手机号") return res else: return x else: return x
def __init__(self, inputs): self.inputs = inputs.replace("\n", "").replace(" ", "") self.P = Pinyin()
def Pinyin(self, *a, **kw): from xpinyin import Pinyin return Pinyin(*a, **kw)
def addBundleToCatalog(self, _item, _uuid, _name, _dir): ''' :param _item: 当前bundle列表中活动的item :param _name: item的新名字 :param _id: item的新id :param _uuid: Qt.UserRule 1、重命名操作 1.1、重命名文件夹 1.2、更新catalog列表 1.3、更新listItem列表 1.4、重新设置_item.setData 2、新增item 2.1、新的bundle信息添加至catalog.json 2.2、更新catalog_list 2.3、添加新item信息到bundle_dict 2.4、重新设置_item.setData ''' old_name = _item.text() new_name = _name new_uuid = Pinyin().get_initials(new_name, splitter='').lower() new_dir = _dir if old_name in self.status.bundle_dict.keys(): for i in range(len(self.catalog_list)): alias = self.catalog_list[i]['alias']['zh_CN'] old_path = self.catalog_list[i]['path'] if old_name == alias.split('/')[0]: self.catalog_list[i]['alias'][ 'zh_CN'] = new_name + '/' + alias.split("/")[1] old_dir = self.catalog_list[i]['bundle'] if alias.split("/")[1] != '_': self.catalog_list[i]['bundle'] = new_dir self.catalog_list[i][ 'path'] = new_uuid + '/' + old_path.split("/")[1] self.catalog_list[i]['uuid'] = new_uuid if self.catalog_list[i]['bundle'] != '': # 1、重命名文件夹 os.renames( os.path.join(self.status.rootdir, 'bundle', old_dir), os.path.join(self.status.rootdir, 'bundle', new_dir)) # 2、更新catalog列表 with open(self.catalog_path, 'w', encoding='utf-8') as f: f.write( json.dumps(self.catalog_list, indent=4, ensure_ascii=False)) # 3、更新listItem列表,并重新链接item.data self.status.bundle_dict.pop(old_name) self.status.bundle_dict[new_name] = new_dir _item.setData(_uuid, new_name) self.Broadcast('/document/bundle/item/rename', None) else: bundle_n = len(self.catalog_list) new_bundle_n = bundle_n // 2 + 1 new_bundle = [{ "alias": { "zh_CN": f"{new_name}/_" }, "bundle": "", "id": new_bundle_n, "index": new_bundle_n, "path": f"{new_uuid}/_", "tags": [], "groups": ["catalog"], "uuid": f"{new_uuid}" }, { "alias": { "zh_CN": f"{new_name}/default" }, "bundle": f"{new_dir}", "id": 100 + new_bundle_n, "index": 100 + new_bundle_n, "path": f"{new_uuid}/default", "tags": [], "groups": ["catalog"], "uuid": f"{new_uuid}/default" }] # 1、新的bundle信息添加至catalog.json with open(self.catalog_path, 'w', encoding='utf-8') as f: f.write( json.dumps(self.catalog_list + new_bundle, indent=4, ensure_ascii=False)) # 2、更新catalog_list with open(self.catalog_path, "r", encoding="UTF-8") as catalog_str: self.catalog_list = json.loads(catalog_str.read()) # 3、添加新item信息到bundle_dict self.status.bundle_dict[new_name] = new_dir # 4、重新设置_item.setData _item.setData(_uuid, new_name)
) shoptype, power = com_sum_before_json['msg']['shopInfo']['shopType'], \ com_sum_before_json['msg']['shopInfo']['power'] com_sum_after_url = "https://www.dianping.com/ajax/json/shopDynamic/allReview" req_after = RequestsConf() params = { 'shopId': store_id, 'cityId': city_id, 'categoryURLName': 'food', 'power': power, 'cityEnName': Pinyin().get_pinyin( city_name.decode("utf-8"), ''), 'shopType': shoptype } after_status = req_after.request( com_sum_after_url, 10, params) if after_status == 200: com_sum_list = req_after.response_json( )['summarys'] if com_sum_list: comment_summary = ':'.join([ com['summaryString'] + '(' + str(com['summaryCount']) + ')' for com in com_sum_list ]) else:
from __future__ import unicode_literals import datetime import hashlib import logging import math import pytz import redis from xpinyin import Pinyin from drilling.models import session, Site, FuelTank, InventoryRecord, FuelOrder, Classification, SecondClassification, \ ThirdClassification, GoodsOrder, Supplier, Receiver, GoodsInventory, AbnormalRecord, CardRecord PINYIN = Pinyin() def get_site_by_slug(slug): obj = session.query(Site).filter(Site.slug == slug).first() return obj if obj else None def update_site_status(site, msg): cache = redis.StrictRedis(db=2) now = get_now_time_with_timezone() encode_msg = '{0}|$|{1: %Y-%m-%d %H:%M:%S}'.format(msg, now) cache.set('site_{0}'.format(site.slug), encode_msg) def create_tank(tid, site_id, *args, **kwargs):
# -*- coding:utf-8 -*- import jieba from xpinyin import Pinyin import re pin = Pinyin() def zh_extract(text): """ 找到文本中的所有中文 """ pattern = "[\u4e00-\u9fa5]+" regex = re.compile(pattern) results_list = regex.findall(text) return results_list def get_char_pinyin(input_text): """ 找到所有中文,如果不是中文,不转化未拼音,即跳过 :param input_text: 原始文本,可能包括中文,英文或其他语言的字符 :return: 中文部分 字符 拼音 list """ return_char_list = [] zh_part_list = zh_extract(input_text) for item_c in zh_part_list: item_char_list = pin.get_pinyin(item_c).split('-') return_char_list.extend(item_char_list) return return_char_list def get_word_pinyin(input_text):
def download(self): global condition condition = "" # 定义爬取信息 pinyin = Pinyin().get_pinyin(self.keyword) pinyinList = pinyin.split("-") keywordPinyin = "".join(pinyinList) URLToScrap = "https://818ps.com/muban/0-0-0-0-%s-null-52_24_0_0-0-0-0.html?route_id=&route=&after_route=" % str( keywordPinyin) URLData = urllib.request.urlopen(URLToScrap).read().decode( "utf-8", "ignore") imageExp = "/pic/(.*?).html" imageURLList = re.compile(imageExp).findall(URLData) imageURLList = list(set(imageURLList)) # 处理信息填写及错误 if len(imageURLList) == 0: print("没有搜索到相关海报") condition = "img:none" elif self.count > len(imageURLList): print("数量过多\n最多%s张" % len(imageURLList)) condition = "img:overflow" elif not self.infoIsCorrect(): print('下载信息填写错误!') condition = "info:error" print(infoIsCorrect(printReason=True)) else: # 网站请求错误处理 try: # 重复下载需要的图片 imageCount = self.count if self.count == 0: # 规则:如果数量为0,下载全部 imageCount = len(imageURLList) for imgSerial in range(imageCount): imgNumber = str(imageURLList[imgSerial]) detailImgURL = "https://818ps.com/detail/" + imgNumber + ".html" detailData = urllib.request.urlopen( detailImgURL).read().decode("utf-8", "ignore") detailImageExp = 'https://img.tuguaishou.com/ips_templ_preview/(.*?)"' detailImgURLArg = re.compile(detailImageExp).findall( detailData) for i in range(len(detailImgURLArg)): finalImageURL = "https://img.tuguaishou.com/ips_templ_preview/" + str( detailImgURLArg[i]) finalImgFileID = str(imgSerial) + '-' + str(imgNumber) print("正在下载:编号为%s的图片..." % finalImgFileID) # 保存图片 file = self.path + str( self.keyword ) + "-" + finalImgFileID + "." + self.suffix if self.isTest == False: self.images.append(file) urllib.request.urlretrieve(finalImageURL, filename=file) print("下载完成!目录:", file) else: print("测试完成!测试伪目录:", file) # 错误处理 except urllib.error.URLError as e: if hasattr(e, 'code'): print(e.code) if hasattr(e, "reason"): print(e.reason)
def url_searchtree_query(key_word_list): result_file_point=open("result_file.txt","w") for i in key_word_list: flag=0 #print(i) #print("---------------------------------------------") for j in i: if is_chinese(j): flag=1 break elif is_alphabet(j): flag=2 break elif is_number(j): flag=3 break if flag==1: transform=Pinyin() #print(transform.get_pinyin(i[0])) first_pinyin=transform.get_pinyin(i[0]) temp_path='' total_path='' for k in first_pinyin: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path else: total_path=total_path+'/'+temp_path #print(total_path) #--------------------------------------------以上生成对应拼音树路径 #print(total_path) final_path=total_path+'/'+i[0]+'.txt' if os.path.isfile(final_path): file_point = open(final_path,"r") turn_exchange=0 keyword_list=[] url_part=[] for line in open(final_path,"r"): if turn_exchange==0: keyword_list=line.split() #print(keyword_list) turn_exchange=1 else: url_part=line.split() #print(url_part) turn_exchange=0 i_exist=0 #这个变量是当前的i检索关键词是否存在于文档中URL的关键词中 quality=0 #这个变量是检索关键词与文档URL关键词的匹配数量(决定这个URL的显示是靠前还是靠后) for search_word in keyword_list: if search_word==i: i_exist=1 if i_exist==1: for search_word in keyword_list: #遍历文档中URL的关键词 for ii in key_word_list: #遍历检索关键词 if search_word==ii: quality=quality+1 #print(i_exist) #print(quality) if i_exist==1: result_url_str=''.join(url_part) #print(result_url_str) result_url_str=result_url_str+'\n' result_file_point.write(result_url_str) temp_quality_str=''+str(quality)+'\n' result_file_point.write(temp_quality_str) file_point.close() else: print("no path") if flag==2: temp_path='' total_path='' for k in i: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path else: total_path=total_path+'/'+temp_path #print(total_path) final_path=total_path+'/'+temp_path+'.txt' if os.path.isfile(final_path): file_point = open(final_path,"r") turn_exchange=0 keyword_list=[] url_part=[] for line in open(final_path,"r"): if turn_exchange==0: keyword_list=line.split() #print(keyword_list) turn_exchange=1 else: url_part=line.split() #print(url_part) turn_exchange=0 i_exist=0 #这个变量是当前的i检索关键词是否存在于文档中URL的关键词中 quality=0 #这个变量是检索关键词与文档URL关键词的匹配数量(决定这个URL的显示是靠前还是靠后) for search_word in keyword_list: if search_word==i: i_exist=1 if i_exist==1: for search_word in keyword_list: #遍历文档中URL的关键词 for ii in key_word_list: #遍历检索关键词 if search_word==ii: quality=quality+1 #print(i_exist) #print(quality) if i_exist==1: result_url_str=''.join(url_part) #print(result_url_str) result_url_str=result_url_str+'\n' result_file_point.write(result_url_str) temp_quality_str=''+str(quality)+'\n' result_file_point.write(temp_quality_str) file_point.close() else: print("no path") if flag==3: temp_path='' total_path='' for k in i: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path else: total_path=total_path+'/'+temp_path #print(total_path) final_path=total_path+'/'+temp_path+'.txt' if os.path.isfile(final_path): file_point = open(final_path,"r") turn_exchange=0 keyword_list=[] url_part=[] for line in open(final_path,"r"): if turn_exchange==0: keyword_list=line.split() #print(keyword_list) turn_exchange=1 else: url_part=line.split() #print(url_part) turn_exchange=0 i_exist=0 #这个变量是当前的i检索关键词是否存在于文档中URL的关键词中 quality=0 #这个变量是检索关键词与文档URL关键词的匹配数量(决定这个URL的显示是靠前还是靠后) for search_word in keyword_list: if search_word==i: i_exist=1 if i_exist==1: for search_word in keyword_list: #遍历文档中URL的关键词 for ii in key_word_list: #遍历检索关键词 if search_word==ii: quality=quality+1 #print(i_exist) #print(quality) if i_exist==1: #如果关键词存在的话要把这个URL以及它的质量数写入result_file.txt文档中 result_url_str=''.join(url_part) #print(result_url_str) result_url_str=result_url_str+'\n' result_file_point.write(result_url_str) temp_quality_str=''+str(quality)+'\n' result_file_point.write(temp_quality_str) file_point.close() else: print("no path") result_file_point.close() #到此为止 result_file.txt 文件中已经存储了若干URL和质量等级 result_file_point=open("result_file.txt","r") #现在要对重复的URL去重合并 turn_exchange=0 #这个变量用来控制交替读入,一行URL,一行quality url_part=[] quality_part=[] main_operation_list=[] main_index=0; for line in open("result_file.txt","r"): if turn_exchange==0: url_part=line.split() #将str转化成list #print(url_part) turn_exchange=1 else: quality_part=line.split() #print(quality_part) turn_exchange=0 result_url_str=''.join(url_part) #将list转换为str result_quality_str=''.join(quality_part) #将list转换为str temp_url_quality=url_quality(result_url_str,int(result_quality_str)) #构造新的url_quality类对象 main_operation_list.append(temp_url_quality) #直接使用list的append追加url_quality类的新对象 main_index=main_index+1 #url_quality类对象的数量 result_file_point.close() #print(main_index) #delete_index_list=[] for i in range(0,main_index): if i+1<main_index: for j in range(i+1,main_index): #两次循环查重、更新最高的quality,要删除的item的quality会被标记为-1 if main_operation_list[i].url==main_operation_list[j].url: if main_operation_list[i].quality==main_operation_list[j].quality: main_operation_list[j].quality=-1 elif main_operation_list[i].quality>main_operation_list[j].quality: main_operation_list[j].quality=-1 elif main_operation_list[i].quality<main_operation_list[j].quality: main_operation_list[i].quality=main_operation_list[j].quality main_operation_list[j].quality=-1 main_operation_list.sort() #对结果list进行sort,被标记为重复的URL会被排序到list尾部 #for item in main_operation_list: #print(item.url) #print(item.quality) if main_operation_list: #检测“如果没有匹配网页”的话就不进行尾部删除操作,不加的话空的list会指针越界 while main_operation_list[-1].quality==-1: #将位于尾部的重复的URL进行删除 del main_operation_list[-1] #print("==========================================") result_file_point=open("result_file.txt","w") #将最后的结果再次写入result_file文件中 for item in main_operation_list: print(item.url) print(item.quality) result_file_point.write(item.url) result_file_point.write("\n") result_file_point.write(str(item.quality)) result_file_point.write("\n") result_file_point.close()
#Copyright(c) 2014 dtysky ######################### import sublime, sublime_plugin import json, os, pickle, codecs, locale, re import sys sys.path.append(os.path.split(__file__)[0]) path = os.path.split(__file__)[0] + '/' + 'User.json' game_path = json.load(open(path, 'r'))['game_gal2renpy_path'] sys.path.append(game_path + 'Gal2Renpy/G2R') sys.path.append(game_path + 'Gal2Renpy') from UserSource import UserSource from UserTag import UserTag from xpinyin import Pinyin Py = Pinyin() US = UserSource(game_path) UT = UserTag(US, game_path + 'Gal2Renpy/TagSource') class Gal2RenpyCompletions(sublime_plugin.EventListener): def __init__(self): pass def on_query_completions(self, view, prefix, locations): def GetNowPoint(): return view.sel()[0].b def GetPointRC(pt): return view.rowcol(pt)
def url_searchtree_build(url,key_word_list): for i in key_word_list: flag=0 for j in i: if is_chinese(j): flag=1 #print("汉字") #print(flag) break elif is_alphabet(j): flag=2 #print("字母") #print(flag) break elif is_number(j): flag=3 #print("数字") #print(flag) break if flag==1: transform=Pinyin() #print(transform.get_pinyin(i[0])) first_pinyin=transform.get_pinyin(i[0]) temp_path='' total_path='' for k in first_pinyin: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path+"/" else: total_path=total_path+temp_path+'/' #print(total_path) if not os.path.isdir(total_path): os.mkdir(total_path) #--------------------------------------------以上生成对应拼音树路径 #print(total_path) final_path=total_path+i[0]+'.txt' file_point = open(final_path,"a") for ii in key_word_list: temp_input=ii+' ' file_point.write(temp_input) file_point.write("\n") file_point.write(url) file_point.write("\n") file_point.close() #---------------------------------------------以上更新对应的汉字文档并写入 if flag==2: temp_path='' total_path='' for k in i: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path+"/" else: total_path=total_path+temp_path+'/' #print(total_path) if not os.path.isdir(total_path): os.mkdir(total_path) #-------------------------------------------以上生成字母检索树路径 #print(total_path) final_path=total_path+temp_path+'.txt' file_point = open(final_path,"a") for ii in key_word_list: temp_input=ii+' ' file_point.write(temp_input) file_point.write("\n") file_point.write(url) file_point.write("\n") file_point.close() #-------------------------------------------更新单词文档 if flag==3: temp_path='' total_path='' for k in i: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path+'/' else: total_path=total_path+temp_path+'/' #print(total_path) if not os.path.isdir(total_path): os.mkdir(total_path) #---------------------------------------------以上产生数字检索树路径 #print(total_path) final_path=total_path+temp_path+'.txt' file_point = open(final_path,"a") for ii in key_word_list: temp_input=ii+' ' file_point.write(temp_input) file_point.write("\n") file_point.write(url) file_point.write("\n") file_point.close()
def oj_upload(instance, filename): p = Pinyin() return '/'.join([ settings.MEDIA_ROOT, "OJ", p.get_pinyin(instance.name) + "/" + "sample.py" ])
def txt_maintain_in_night(): keywords_part=[] keywords_str='' for line in open("temp_keywords_list.txt","r"): keywords_part=line.split() keywords_str=''.join(keywords_part) print(keywords_str) flag=0 for i in keywords_str: if is_chinese(i): flag=1 #print("汉字") #print(flag) break elif is_alphabet(i): flag=2 #print("字母") #print(flag) break elif is_number(i): flag=3 #print("数字") #print(flag) break if flag==1: transform=Pinyin() #print(transform.get_pinyin(i[0])) first_pinyin=transform.get_pinyin(keywords_str[0]) temp_path='' total_path='' for k in first_pinyin: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path+"/" else: total_path=total_path+temp_path+'/' if not os.path.isdir(total_path): os.mkdir(total_path) #--------------------------------------------------------以上生成对应拼音树路径 #print(total_path) main_operation_list=[] count=0 final_path=total_path+keywords_str[0]+'.txt' if os.path.isfile(final_path): turn_exchange=0 keyword_list=[] url_part=[] for line in open(final_path,"r"): if turn_exchange==0: keyword_list=line.split() turn_exchange=1 else: url_part=line.split() turn_exchange=0 result_url_str=''.join(url_part) temp_keyword_url=keyword_url(keyword_list,result_url_str) #构造新的url_quality类对象 main_operation_list.append(temp_keyword_url) count=count+1 for item in main_operation_list: print("===================") print(item.keyword) print(item.url) print("====================") print(count) if count>=300: diff=count-300 for j in range(0,diff): del main_operation_list[0] url_txt_point=open(final_path,"w") for item in main_operation_list: for key in item.keyword: temp_input=key+' ' url_txt_point.write(temp_input) url_txt_point.write("\n") url_txt_point.write(item.url) url_txt_point.write("\n") url_txt_point.close() if flag==2: temp_path='' total_path='' for k in keywords_str: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path+"/" else: total_path=total_path+temp_path+'/' #print(total_path) if not os.path.isdir(total_path): os.mkdir(total_path) #-------------------------------------------以上生成字母检索树路径 main_operation_list=[] count=0 #print(total_path) final_path=total_path+temp_path+'.txt' if os.path.isfile(final_path): turn_exchange=0 keyword_list=[] url_part=[] for line in open(final_path,"r"): if turn_exchange==0: keyword_list=line.split() turn_exchange=1 else: url_part=line.split() turn_exchange=0 result_url_str=''.join(url_part) temp_keyword_url=keyword_url(keyword_list,result_url_str) #构造新的url_quality类对象 main_operation_list.append(temp_keyword_url) count=count+1 for item in main_operation_list: print("===================") print(item.keyword) print(item.url) print("====================") print(count) if count>=300: diff=count-300 for j in range(0,diff): del main_operation_list[0] url_txt_point=open(final_path,"w") for item in main_operation_list: for key in item.keyword: temp_input=key+' ' url_txt_point.write(temp_input) url_txt_point.write("\n") url_txt_point.write(item.url) url_txt_point.write("\n") url_txt_point.close() if flag==3: temp_path='' total_path='' for k in keywords_str: temp_flag=0 if temp_path=='': temp_flag=1 else: temp_flag=0 temp_path=temp_path+k if temp_flag==1: total_path=total_path+temp_path+"/" else: total_path=total_path+temp_path+'/' #print(total_path) if not os.path.isdir(total_path): os.mkdir(total_path) #-------------------------------------------以上生成字母检索树路径 main_operation_list=[] count=0 #print(total_path) final_path=total_path+temp_path+'.txt' if os.path.isfile(final_path): turn_exchange=0 keyword_list=[] url_part=[] for line in open(final_path,"r"): if turn_exchange==0: keyword_list=line.split() turn_exchange=1 else: url_part=line.split() turn_exchange=0 result_url_str=''.join(url_part) temp_keyword_url=keyword_url(keyword_list,result_url_str) #构造新的url_quality类对象 main_operation_list.append(temp_keyword_url) count=count+1 for item in main_operation_list: print("===================") print(item.keyword) print(item.url) print("====================") print(count) if count>=300: diff=count-300 for j in range(0,diff): del main_operation_list[0] url_txt_point=open(final_path,"w") for item in main_operation_list: for key in item.keyword: temp_input=key+' ' url_txt_point.write(temp_input) url_txt_point.write("\n") url_txt_point.write(item.url) url_txt_point.write("\n") url_txt_point.close()
def change_form_six(song, singer): p = Pinyin() connect_list = ['', ' ', '-'] connect_str = connect_list[random.randint(0, len(connect_list) - 1)] return p.get_pinyin(song, connect_str)
import openpyxl import pandas as pd from xpinyin import Pinyin from idlelib.iomenu import encoding import getpass import time import os from netaddr import IPNetwork, IPAddress # Internal imports # Import only with "from x import y", to simplify the code. from bigrest.bigip import BIGIP from bigrest.utils.utils import rest_format from bigrest.utils.utils import token # p = Pinyin() urllib3.disable_warnings() #disable ssl warning # System call os.system("") # Class of different styles class style(): BLACK = '\033[30m' RED = '\033[31m' GREEN = '\033[32m' YELLOW = '\033[33m' BLUE = '\033[34m' MAGENTA = '\033[35m' CYAN = '\033[36m' WHITE = '\033[37m'
from xpinyin import Pinyin pinyinLib = Pinyin() with open( 'D:\\text.txt', 'r' ) as srcFile, open( 'D:\\pinyin.txt', 'w' ) as desFile: for line in srcFile: parenthesisLength = [] words = line.split() for word in words: result = pinyinLib.get_pinyin( word, splitter = ' ', show_tone_marks = True ) desFile.writelines( result + '\t\t' ) parenthesisLength.append( len(result) ) desFile.writelines( '\n' ) for pLength in parenthesisLength: desFile.writelines( '(' + ''.join( [' ']*(pLength - 2) ) + ')' + '\t\t' )
in_f = file('e:/Downloads/iCloud vCards yidaochu.vcf') #data = in_f.read() data_per_line = in_f.readlines() results = [] #out_f.write(data) for line in data_per_line: Key = line.split(':') if len(Key) > 1: result_key = '%s:%s' % (Key[0], Key[1]) array = Key[1].split(';') else: result_key = '%s:\n' % (Key[0]) p = Pinyin() tmp = unicode(array[0], 'utf-8') First_name_Key = p.get_pinyin(tmp).capitalize() Phonetic_line = 'X-PHONETIC-LAST-NAME:%s\n' % First_name_Key if Key[0] == 'N': results.append(result_key) results.append(Phonetic_line) elif Key[0] == 'N;LANGUAGE=en-us': results.append(result_key) #results.append (Phonetic_line) elif Key[0] == 'X-PHONETIC-LAST-NAME': comment = 'did nothing' else: results.append(line) in_f.close()
wf.writeframes(b''.join(frames)) wf.close() with open('audio.wav', 'rb') as fp: wave = fp.read() print("* 正在识别......", len(wave)) result = client.asr(wave, 'wav', 16000, {'dev_pid': 1537}) print(result) if result["err_no"] == 0: for t in result["result"]: print(t) else: print("没有识别到语音\n", result["err_no"]) p = Pinyin() ptxt = p.get_pinyin(result["result"][0]) print(ptxt) if "ma-po-dou-fu" in ptxt: voice = client.synthesis("好的,你要几碗?", 'zh', 6, { 'vol': 15, 'per': 4, 'spd': 5 }) with open("playback.mp3", 'wb') as fp: fp.write(voice) os.system("playback.mp3") CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2
def main(): cityZH = input('要查询的城市名称:') p = Pinyin() cityPY = p.get_pinyin(cityZH,'') url = f'http://www.pm25x.com/city/{cityPY}.htm' print(cityZH,'PM2.5:',cityDetail(url))
def term_pinyin(word): word = digi_to_py(word) p = Pinyin() result = p.get_pinyin(word, ' ') return result
def member_process(self): py = Pinyin() cur_time = int(time.time()) cur_short_time = time.strftime('%Y-%m-%d', time.localtime(cur_time)) cur_time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(cur_time)) with self.conn as db: sql = "SELECT * FROM " + self.__old_table_name ; try: # 获取所有记录列表 db.cursor.execute(sql) results = db.cursor.fetchall(); for row in results: member_name = safe_string(row["company_full_name"]).replace(' ', '') tax_number = safe_string(row["tax_number"]).replace(' ', '') if member_name == "" or tax_number == "": continue #106 1409 2189 sql = "SELECT * FROM " + self.__new_table_name + " WHERE company_full_name = %s"; db.cursor.execute(sql, (row["company_full_name"])) members = db.cursor.fetchall(); if len(members) > 0: continue sql = "INSERT INTO " + self.__new_table_name + " VALUES(%s, %s, %s, %s, %s, %s\ ,%s, %s, %s, %s, %s)" param = (row["id"],row["company_full_name"], safe_string(row["company_short_name"]), py.get_pinyin(safe_string(row["company_full_name"])).replace("-","")\ ,py.get_pinyin(safe_string(row["company_short_name"])).replace("-",""),row["tax_number"] \ ,"0", row["create_time"], time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(row["create_time"])/1000)) \ ,"1", row["last_access"] ) db.cursor.execute(sql, param) db.conn.commit() sql = "INSERT INTO t_member_public(member_id,company_nature,company_type,province_code\ , province_name, city_code, city_name, district_code, district_name\ , address, reg_time, reg_capital, register_money_type, legal_person_name\ ,legal_person_id_card, legal_person_phone, linkman, mobile, phone, fax\ , post_code, email, website, `scale`, remark,editor_id, last_access, creator_id\ , create_time, version) VALUES(%s, %s, %s, %s, %s, %s\ ,%s, %s, %s, %s, %s, %s \ ,%s, %s, %s, %s, %s, %s \ ,%s, %s, %s, %s, %s, %s \ ,%s, %s, %s, %s, %s, %s \ )" param = (row["id"],row["company_nature"], row["company_type"], safe_string(row["province_code"])\ ,safe_string(row["province_name"]), safe_string(row["city_code"]), safe_string(row["city_name"]), \ safe_string(row["district_code"]), safe_string(row["district_name"]), safe_string(row["address"]) \ ,safe_string(row["reg_time"]),safe_string(row["reg_capital"]), row["register_money_type"],\ safe_string(row["legal_person_name"]),safe_string(row["legal_person_id_card"]), row["legal_person_phone"],\ safe_string(row["linkman"]),safe_string(row["mobile"]), safe_string(row["phone"]),safe_string(row["fax"]),safe_string(row["post_code"]),\ safe_string(row["email"]),safe_string(row["website"]), safe_string(row["scale"]),safe_string(row["remark"]),row["editor_id"],\ row["last_access"], row["creator_id"], row["create_time"]\ ,"1") db.cursor.execute(sql, param) db.conn.commit() #打印结果 print(param) except: traceback.print_exc()
def get_shouzimu(hanzi): p = Pinyin() return p.get_initials(hanzi, u'')
def post(self): self.xsrf_form_html() data = self.request.files["file"][0] if (data): pd = self.get_argument("port_direction", default="0") zpp = self.get_argument("zero_port_pos", default="2") ps = self.get_argument("port_sort", default="0") GPS = self.get_argument("GPS", default="") address = self.get_argument("address", default="") OBDCode = self.get_argument("OBDCode", default="") #保存原始图片 # time = datetime.datetime.now() #sql time: .strftime("%Y-%m-%d %H:%M:%S") md5 = hashlib.md5() md5.update(data["body"]) md5encode = md5.hexdigest() ran_str = ''.join( random.sample(string.ascii_letters + string.digits, 8)) extension = data["filename"].split(".")[-1] head = data["filename"].rstrip("." + extension) #将文件名中文转化为拼音 pinyin = Pinyin() head = pinyin.get_pinyin(head) #中文转拼音结束 print(extension) savename = head + "_" + md5encode + ran_str + "." + extension #time.strftime("%Y_%m_%d_%H_%M_%S")+"_"+md5encode+"."+data["filename"].split(".")[-1] picture_path = os.path.join("uploadpic", savename) #写入文件 with open(os.path.join("static", picture_path), "wb") as up: up.write(data["body"]) #需要添加confimed的代码 req = {"port_direction": pd, "zero_port_pos": zpp, "port_sort": ps} #"method"为深度学习对应的API fci = fcisservice.remote( "", req, open(os.path.join("static", picture_path), 'rb')) QR = QRCode(os.path.join("static", picture_path)) if (address): QR["address"] = address if (OBDCode): QR["code"] = OBDCode if (GPS): QR["GPS"] = GPS if fci["body"] == "noimg" or fci["body"] == "detectbusy" or fci[ "body"] == "": confirmed_picture_path = "" ports_occupy = "" print("confirmed_picture_path unexists\n") else: confirmdata = fci["body"] ports_occupy = str(fci["Ports_occupy"]) confirmname = head + "_" + md5encode + ran_str + ports_occupy + "." + extension #time.strftime("%Y_%m_%d_%H_%M_%S")+"_"+md5encode+"."+data["filename"].split(".")[-1] confirmed_picture_path = os.path.join("confirmedpic", confirmname) with open(os.path.join("static", confirmed_picture_path), "wb") as up: up.write(confirmdata) # 查询旧的数据 oldOBDsql = db.session().query(db.Picture).order_by( db.Picture.create_time.desc()).filter( db.Picture.code == str(QR["code"]) and db.Picture.is_correct == 1).first() oldOBDInfo = {} if oldOBDsql: oldOBDInfo = oldOBDsql.__dict__ oldOBDInfo["msg"] = "success" #调整数据 del oldOBDInfo["_sa_instance_state"] oldOBDInfo["create_time"] = str(oldOBDsql.create_time) oldOBDInfo["update_time"] = str(oldOBDsql.update_time) else: oldOBDInfo["msg"] = "nodata" #对端口识别和二维码识别的判断 res = {} is_correct = 0 if fci["body"] == "detectbusy": res["msg"] = "detectbusy" else: if confirmed_picture_path == "" and QR["code"] == "": res["msg"] = "AllFail" elif confirmed_picture_path != "" and QR["code"] == "": res["msg"] = "QrcodeFail" elif confirmed_picture_path == "" and QR["code"] != "": res["msg"] = "DetectFail" else: is_correct = 1 res["msg"] = "success" # 插入新的数据到数据库 pic = db.Picture(code=str(QR["code"]), name=str(QR["name"]), address=str(QR["address"]), GPS=str(QR["GPS"]), port_direction=pd, zero_port_pos=zpp, port_sort=ps, ports_occupy=ports_occupy, is_correct=is_correct, uncorrect_msg=res["msg"], picture_path=picture_path, confirmed_picture_path=confirmed_picture_path, user_id=self.get_secure_cookie("user_id")) s = db.session() s.add(pic) s.flush() res["id"] = pic.id s.commit() s.close() #返回json,获取信息 #del res["body"] res["oldOBDInfo"] = oldOBDInfo res["code"] = str(QR["code"]) res["name"] = str(QR["name"]) res["address"] = str(QR["address"]) res["GPS"] = str(QR["GPS"]) res["confirmed_picture_path"] = os.path.join( confirmed_picture_path) res["picture_path"] = os.path.join(picture_path) res["ports_occupy"] = ports_occupy self.write(res) else: self.write(tornado.escape.json_encode({"msg": "false"}))
# -*- coding: utf-8 -*- from xpinyin import Pinyin import sys import re p = Pinyin() #print p.get_pinyin(u"上海") for line in sys.stdin: word = line.strip() word = word.decode('utf-8') if ' ' in word: continue if '\t' in word: continue #for c in [u'(', u')', u'(', u')']: #if c in word: #continue word_pinyin = p.get_pinyin(word, u' ') if re.match(r'^[a-z ]+$', word_pinyin): sys.stdout.write(('%s\t%s\t1\n' % (word, word_pinyin)).encode('utf-8')) else: continue
def get_pinyin(zh_name): ''' 中文转拼音 ''' p = Pinyin() return p.get_pinyin(zh_name, '')