Пример #1
0
from __future__ import print_function
import sys

from polarity_classifier import PolarityClassifier
from KafNafParserPy import KafNafParser

if __name__ == '__main__':

    files = []
    fd = open('nl.list.test')
    for line in fd:
        files.append(line.strip())
    fd.close()

    my_polarity_classifier = PolarityClassifier('nl')
    my_polarity_classifier.load_models(sys.argv[1])

    OK = WR = 1
    for example_file in files:
        this_obj = KafNafParser(example_file)

        my_polarity_classifier.classify_kaf_naf_object(this_obj)
        this_obj.dump()

        break

        GOLD = {}
        list_ids_term_ids = []
        for opinion in this_obj.get_opinions():
            op_exp = opinion.get_expression()
            polarity = op_exp.get_polarity()
Пример #2
0
        for e, t, h in final_triples:
            print('    ==>', file=sys.stderr)
            print('      Expression:', e.to_line(), file=sys.stderr)
            if t is None:
                print('      Target: NONE', file=sys.stderr)
            else:
                print('      Target:', t.to_line(), file=sys.stderr)

            if h is None:
                print('      Holder: NONE', file=sys.stderr)
            else:
                print('      Holder:', h.to_line(), file=sys.stderr)

    #Remove feature_file feature_file
    #Remove also the target file  target_features_file

    os.remove(feature_file)
    os.remove(target_features_file)
    os.remove(holder_features_file)

    ## CREATE THE KAF/NAF OPINIONS
    add_opinions(final_triples, kaf_naf_obj)

    if args.polarity:
        my_polarity_classifier = PolarityClassifier(language)
        my_polarity_classifier.load_models(
            os.path.join(__here__, 'polarity_models', language))
        my_polarity_classifier.classify_kaf_naf_object(kaf_naf_obj)

    kaf_naf_obj.dump()
Пример #3
0
            if t is None:
                print('      Target: NONE', file=sys.stderr)
            else:
                print('      Target:', t.to_line(), file=sys.stderr)
            
            if h is None:
                print('      Holder: NONE', file=sys.stderr)
            else:
                print('      Holder:', h.to_line(), file=sys.stderr)
            
             
    
    #Remove feature_file feature_file
    #Remove also the target file  target_features_file
    
    os.remove(feature_file)
    os.remove(target_features_file)
    os.remove(holder_features_file)
    
    
    ## CREATE THE KAF/NAF OPINIONS
    add_opinions(final_triples,kaf_naf_obj)
    
    if args.polarity:
        my_polarity_classifier = PolarityClassifier(language)
        my_polarity_classifier.load_models(os.path.join(__here__,'polarity_models',language))
        my_polarity_classifier.classify_kaf_naf_object(kaf_naf_obj)
    
    kaf_naf_obj.dump()
    
import sys

from polarity_classifier import PolarityClassifier
from KafNafParserPy import KafNafParser


if __name__ == '__main__':
    
    files = []
    fd = open('nl.list.test')
    for line in fd:
        files.append(line.strip())
    fd.close()

    my_polarity_classifier = PolarityClassifier('nl')
    my_polarity_classifier.load_models(sys.argv[1])

    OK = WR = 1
    for example_file in files:
        this_obj = KafNafParser(example_file)
        
        
        my_polarity_classifier.classify_kaf_naf_object(this_obj)
        this_obj.dump()

        break
    
        GOLD = {}
        list_ids_term_ids = []
        for opinion in this_obj.get_opinions():
            op_exp = opinion.get_expression()