QINGCHE commited on
Commit
6bfccc1
1 Parent(s): ff0b0c6

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +46 -46
run.py CHANGED
@@ -1,46 +1,46 @@
1
- import util
2
- import abstract
3
- import classification
4
- import inference
5
- import outline
6
- from inference import BertClassificationModel
7
- # input:file/text,topic_num,max_length,output_choice
8
- # output:file/text/topic_sentence
9
-
10
-
11
- # file_process:
12
- # in util
13
- # read file code
14
- # file to json_text
15
-
16
- # convert:
17
- # in util
18
- # convert code
19
- # json_text to text
20
-
21
- # process:
22
- # in util
23
- # text process code
24
- # del stop seg
25
-
26
- def texClear(article):
27
- sentencesCleared = [util.clean_text(sentence) for sentence in article]
28
- sentencesCleared = [string for string in sentencesCleared if string != '' ]
29
- # print(sentencesCleared)
30
- return sentencesCleared
31
-
32
- def textToAb(sentences, article, topic_num, max_length):
33
- central_sentences = abstract.abstruct_main(sentences, topic_num)
34
- groups = classification.classify_by_topic(article, central_sentences)
35
- groups = util.article_to_group(groups, central_sentences)
36
- title_dict,title = util.generation(groups, max_length)
37
- # ans:
38
- # {Ai_abstruct:(main_sentence,paragraph)}
39
- print(title)
40
- matrix = inference.inference_matrix(title)
41
-
42
- _,outline_list = outline.passage_outline(matrix,title)
43
-
44
- output = util.formate_text(title_dict,outline_list)
45
-
46
- return title, output
 
1
+ import util
2
+ import abstract
3
+ import classification
4
+ import inference
5
+ import outline
6
+ from inference import BertClassificationModel
7
+ # input:file/text,topic_num,max_length,output_choice
8
+ # output:file/text/topic_sentence
9
+
10
+
11
+ # file_process:
12
+ # in util
13
+ # read file code
14
+ # file to json_text
15
+
16
+ # convert:
17
+ # in util
18
+ # convert code
19
+ # json_text to text
20
+
21
+ # process:
22
+ # in util
23
+ # text process code
24
+ # del stop seg
25
+
26
+ def texClear(article):
27
+ sentencesCleared = [util.clean_text(sentence) for sentence in article]
28
+ sentencesCleared = [string for string in sentencesCleared if string != '' ]
29
+ # print(sentencesCleared)
30
+ return sentencesCleared
31
+
32
+ def textToAb(sentences, article, topic_num, max_length):
33
+ central_sentences = abstract.abstruct_main(sentences, topic_num)
34
+ groups = classification.classify_by_topic(article, central_sentences)
35
+ groups = util.article_to_group(groups, central_sentences)
36
+ title_dict,title = util.generation(groups, max_length)
37
+ # ans:
38
+ # {Ai_abstruct:(main_sentence,paragraph)}
39
+ print(title)
40
+ matrix = inference.inference_matrix(title)
41
+
42
+ outline,outline_list = outline.passage_outline(matrix,title)
43
+
44
+ output = util.formate_text(title_dict,outline_list)
45
+
46
+ return outline, output