VyLala commited on
Commit
0350f6f
·
verified ·
1 Parent(s): 6c4c0dd

Update smart_fallback.py

Browse files
Files changed (1) hide show
  1. smart_fallback.py +9 -1
smart_fallback.py CHANGED
@@ -3,6 +3,7 @@ from Bio import Entrez, Medline
3
  import mtdna_classifier
4
  from NER.html import extractHTML
5
  import data_preprocess
 
6
  # Setup
7
  def fetch_ncbi(accession_number):
8
  try:
@@ -168,7 +169,14 @@ def filter_links_by_metadata(search_results, saveLinkFolder, accession=None):
168
  keywords = [accession] + keywords
169
  title_snippet = link.lower()
170
  print("save link folder inside this filter function: ", saveLinkFolder)
171
- article_text = data_preprocess.extract_text(link,saveLinkFolder)
 
 
 
 
 
 
 
172
  print("article text")
173
  #print(article_text)
174
  try:
 
3
  import mtdna_classifier
4
  from NER.html import extractHTML
5
  import data_preprocess
6
+ import pipeline
7
  # Setup
8
  def fetch_ncbi(accession_number):
9
  try:
 
169
  keywords = [accession] + keywords
170
  title_snippet = link.lower()
171
  print("save link folder inside this filter function: ", saveLinkFolder)
172
+ success_process, output_process = pipeline.run_with_timeout(data_preprocess.extract_text,args=(link,saveLinkFolder),timeout=60)
173
+ if success_process:
174
+ article_text = output_process
175
+ print("yes succeed for getting article text")
176
+ else:
177
+ print("no suceed, fallback to no link")
178
+ article_text = ""
179
+ #article_text = data_preprocess.extract_text(link,saveLinkFolder)
180
  print("article text")
181
  #print(article_text)
182
  try: