Total Complexity | 3 |
Total Lines | 14 |
Duplicated Lines | 0 % |
Changes | 11 | ||
Bugs | 0 | Features | 0 |
1 | #!/usr/bin/env python |
||
10 | class Processor(object): |
||
11 | |||
12 | def __init__(self, address): |
||
13 | self.service = "{}/annotate".format(address) |
||
14 | |||
15 | def annotate(self, text): |
||
16 | try: |
||
17 | # load json and build Sentences and Document |
||
18 | annotated_text = post_json(self.service, json.dumps({"text":"{}".format(text)})) |
||
19 | return Document.load_from_JSON(annotated_text) |
||
20 | |||
21 | except Exception as e: |
||
22 | #print(e) |
||
23 | return None |
||
24 | #raise Exception("Connection refused! Is the server running?") |
||
41 |