123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- # -*- coding:utf-8 -*-
- # import nltk
- import re
- # from collections import Counter
- # def get_key_word(s:str):
- # tokens = nltk.word_tokenize(s.lower())
- # word_tag = nltk.pos_tag(tokens)
- # print(word_tag)
- # ns = []
- # for i in word_tag:
- # if i[1] in ['NN','NNS'] and i[1] not in ['s','i']:
- # ns.append(i[0])
- # res = Counter(ns).most_common()
- # if len(res):
- # for i in res:
- # if len(i[0])>2 and i[0] not in ['times'] and re.search('[A-Za-z]+$',i[0]):
- # return i[0]
- # return s.split()[0]
- #
- #
- #
- # s = get_key_word("An Italian company has created the world’s first underwater farm.</br>The station named Nemo’s Garden consists of five biospheres(生物圈)</br>fixed to the bottom of the sea off the coast of Savona, Italy. They’re being used to grow strawberries, beans, garlic, and lettuce.</br>“The main target of this project is to create other sources of plant production in areas where environmental conditions make it difficult to grow crops through traditional farming, including lack of fresh water, fertile soil, and extreme temperature changes,’’ said project spokesperson Luca Gamberini.</br>The five biospheres, currently floating between depths of 18 and', 'final_draft': 1, '_id': ObjectId('5dc2724289d8aa1e84586b64'), 'status': 0, 'type': 1, 'all_content': 'An Italian company has created the world’s first underwater farm.</br>The station named Nemo’s Garden consists of five biospheres(生物圈)</br>fixed to the bottom of the sea off the coast of Savona, Italy. They’re being used to grow strawberries, beans, garlic, and lettuce.</br>“The main target of this project is to create other sources of plant production in areas where environmental conditions make it difficult to grow crops through traditional farming, including lack of fresh water, fertile soil, and extreme temperature changes,’’ said project spokesperson Luca Gamberini.</br>The five biospheres, currently floating between depths of 18 and feet, are constantly watched by Ocean Reef Group —— a diving equipment company——from a control center on dry land. According to various news reports,\nthe plants are watered by drips of water on the inner walls of the biospheres.\nWith a constant temperature of 79 degrees day and night, and humidity(湿度)\nat around 83 percent, the conditions are ideal for plants to grow well. The high amount of carbon dioxide also encourages growth.\nOcean Reef president Sergio Gamberini said he came up with the idea of growing plants underwater during a summer vacation in Italy. In his own words, he wanted to do something that’s different and to show the beauty of the ocean. After two years of failed attempts, they finally were able to get these five biospheres working. Their success may lay the foundation for a new form of crop production that can be done without harming the environment.\nIn fact, the biosphere seems to be attracting wildlife. Octopuses(章鱼)\nand endangered seahorses are taking shelter under the structure, while crabs(螃蟹)\nare climbing up the anchors and into the greenhouses. None of the creatures have damaged the plants so far. “It’s so kind of science-fiction to see these two different forms of life interact,” Gamberini said. Why was the underwater farm created? Sergio Gamberini got the idea of growing plants underwater _______. The last paragraph is written mainly to tell us that _____. What is the text mainly about")
- #
- # print(s)
- print(re.match('a','bbva'.strip()))
- def db_checker(mode: int):
- # 0->云题库
- # 1->临时题库
- # 2->美文
- group = get_group()
- data = 1
- while data:
- start = time.time()
- print(group)
- data = ld.Executor().find_one({'checked': 0, 'type': mode, 'status': 1})
- if not data:
- break
- res = get_similar(data)
- if not res:
- group += 1
- data['group'] = group
- data['final_draft'] = 1
- data['checked'] = 1
- data['sim_score'] = 1
- ld.update(data, 'exis')
- else:
- add = 0
- all_topic_id = [i[0] for i in res]
- res_dic = {k: v for k, v in res}
- all_sim_topic = ld.Executor().find({'topic_id': {'$in': all_topic_id}, 'checked': 1})
- if all_sim_topic.count() > 0:
- sim_group = -1
- data_topic = None
- for temp in all_sim_topic:
- if 'final_draft' in temp and temp['final_draft'] == 1:
- sim_group = temp['group']
- data_topic = temp
- if sim_group > 0:
- add = 1
- data['group'] = sim_group
- data['final_draft'] = 0
- data['checked'] = 1
- data['sim_score'] = res_dic[data['topic_id']]
- ld.update(data, 'exis')
- not_checked_topic = ld.Executor().find({'topic_id': {'$in': all_topic_id}, 'checked': 0})
- for not_checked_data in not_checked_topic:
- not_checked_data['group'] = sim_group
- not_checked_data['final_draft'] = 0
- not_checked_data['checked'] = 1
- try:
- not_checked_data['sim_score'] = Radio.fast_ratio(not_checked_data['all_content'],
- data_topic['all_content'])
- except Exception as e:
- print(e)
- not_checked_data['sim_score'] = 0.8
- ld.update(not_checked_data, 'exis')
- if add == 0:
- group += 1
- data['group'] = group
- data['final_draft'] = 1
- data['checked'] = 1
- data['sim_score'] = res_dic[data['topic_id']]
- ld.update(data, 'exis')
- not_checked_topic = ld.Executor().find({'topic_id': {'$in': all_topic_id}})
- for not_checked_data in not_checked_topic:
- not_checked_data['group'] = group
- not_checked_data['final_draft'] = 0
- not_checked_data['checked'] = 1
- not_checked_data['sim_score'] = res_dic[not_checked_data['topic_id']]
- ld.update(not_checked_data, 'exis')
- print(time.time() - start)
|