def answer(question): if "刘华振" in question: return "你是问管理员吗?管理员是我爸爸,不要说我爸爸的坏话" info = get_name_from_manager(question) answers = '' name = stock_managers_service.get_manager_info_by_name(question) for one in info: current = [] for n in name: if n['离任日期'] == '': current.append(n) a = get_stock_code_in_question(one.split(',')[0]) if len(current) == 0: return "没有您要知道的信息", question answers = '为您找到这些这些消息' + ',' + current[0]['姓名'] + ',' + ('女' if (current[0]['性别'] == 'F') else '男') + ',' + \ current[0]['出生年月'] + '月出生,' + '在' + a[0].stock_name + '担任以下职位---' manager = '高管:' stock_holder = '董事会:' other = '其他:' for c in current: if c['岗位类别'] == '其他': other = other + "[" + c['岗位'] + ']' if c['岗位类别'] == '董事会成员': stock_holder = stock_holder + "[" + c['岗位'] + ']' if c['岗位类别'] == '高管': manager = manager + "[" + c['岗位'] + ']' if other == '其他:': other = '' answers = answers + "</br>" + manager + "</br>" + stock_holder + "</br>" + other return answers, name
def answer(question, intention): domains = get_stock_code_in_question(question) # type: list[CompanyNamedEntity] if len(domains) == 0: return answer_product_contain_company(question) elif intention == "产品": return answer_company_contain_product(domains) return '没办法回答你的问题'
def answer(question, intention): domains = get_stock_code_in_question(question) # 得到问题的所有实体 if not len(domains): return '我没有你要知道的' all_answers = '您是想问' + intention + "的方面吧。" for one_domain in domains: current_company_index, value_comment_pb, industry, value_comment_pe = get_one_company_value_comment_pb( one_domain) company_trends = get_company_trends_node(one_domain) current_company_finance_index, increase_comment = get_one_company_increase_comment( one_domain) template = "" template = template.replace("data", company_trends['日期'][0]). \ replace('stocknumber', one_domain[1]). \ replace('stockname', one_domain[2]). \ replace('hangye', industry). \ replace("pe", str(current_company_index['市盈率'])). \ replace('mouge_1', value_comment_pe). \ replace("pb", str(current_company_index['市净率'])). \ replace('mouge_2', value_comment_pe). \ replace("zengzhanglv", str(current_company_finance_index['利润总额同比增长率百分比'])). \ replace('mouge_crease', increase_comment). \ replace("status", company_trends['股价状态'][0]). \ replace('area', company_trends['超买超卖'][0]). \ replace("hinder", company_trends['阻力位']). \ replace('embrace', company_trends['支撑位']) all_answers = all_answers + "</br>" + template return all_answers, domains
def answer(question, intention): """ # 回答的主要方法 :param intention: :param question: 传入问题 :return: """ domains = get_stock_code_in_question( question) # type: list[CompanyNamedEntity] print(domains) if not len(domains): return '我没有你要知道的【趋势】信息', "" all_answers = '您是想问' + intention + "的方面吧。" for domain in domains: properties = stock_trends_service.get_one_company_trend( domain.stock_num) template = get_templates(properties).content answers = template.replace("data", properties['日期'][0]). \ replace("stocknumber", domain.stock_num).\ replace("stockname", domain.stock_name).\ replace("status", properties['股价状态'][0]).\ replace("area", properties['超买超卖'][0]).\ replace("hinder", properties['阻力位']).\ replace("embrace", properties['支撑位']) all_answers = all_answers + "</br>" + answers return all_answers, domains
def answer(question, intention): domains = get_stock_code_in_question(question) # type: list[CompanyNamedEntity] if len(domains) == 0: return '没明白您的意思呢', domains return answer_region(domains)
def answer(question, intention): domains = get_stock_code_in_question( question) # type: list[CompanyNamedEntity] if len(domains) == 0: return answer_concept_contain(question) if intention == "概念": return answer_concept(domains) return '没办法回答你的问题', domains
def answer(question, intention): domains = get_stock_code_in_question( question) # type: list[CompanyNamedEntity] if len(domains) == 0 and intention == '所属行业': return answer_industry_contain(question) if intention == "所属行业": return answer_industry(domains) return '没明白您的意思呢'
def answer(question, intention): domains = get_stock_code_in_question(question) # type: list all_answers = '您是想问' + intention + "的方面吧。" # 输入几个实体,对应几条回答 if len(domains) == 0: return '我没有你要知道的【持有或卖信息】', domains for domain in domains: properties = get_one_company_trend(domain.stock_num) template = get_templates(properties).content # 调用模板选择函数 answers = template.replace("data", properties['日期'][0]).replace( "stocknumber", domain).replace("stockname", domain.stock_name).replace( "status", properties['股价状态'][0]).replace( "area", properties['超买超卖'][0]).replace( "hinder", properties['阻力位']).replace("embrace", properties['支撑位']) all_answers = all_answers + "</br>" + answers return all_answers, domains
def answer(question, intention): domains = get_stock_code_in_question( question) # type: list[CompanyNamedEntity] return answer_exchange(domains)