File size: 747 Bytes
dc07399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
try:
    from .src.run import NLP_classification
except:
    from src.run import NLP_classification
import yaml
import os


class paragraph_extract:
    def __init__(self):
        config_file = 'configs/config.yaml'
        config_file = os.path.join(os.path.dirname(__file__), config_file)
        self.config = yaml.load(open(config_file), Loader=yaml.FullLoader)
        self.config['extract']['selected_model'] = os.path.join(os.path.dirname(__file__), self.config['extract']['selected_model'])
        
        self.runner = NLP_classification(**self.config['model'])

    def extract(self, paragraphs, positions):

        labels = self.runner.label_extraction(paragraphs, positions, **self.config['extract'])
        
        return labels