|
27 | 27 | from socket import gaierror |
28 | 28 | import requests |
29 | 29 | import re |
| 30 | +import warnings |
30 | 31 |
|
31 | 32 | _BINDING_VERSION = '1.1.1' |
32 | 33 | _GZIP_BYTEARRAY = bytearray([0x1F, 0x8b, 0x08]) |
@@ -752,16 +753,23 @@ def morphology(self, parameters, facet=MorphologyOutput.COMPLETE): |
752 | 753 | @return: A python dictionary containing the results of morphological analysis.""" |
753 | 754 | return EndpointCaller(self, "morphology/" + facet).call(parameters) |
754 | 755 |
|
755 | | - def entities(self, parameters): |
| 756 | + def entities(self, parameters, resolve_entities=False): |
756 | 757 | """ |
757 | 758 | Create an L{EndpointCaller} to identify named entities found in the texts |
758 | 759 | to which it is applied and call it. Linked entity information is optional, and |
759 | 760 | its need must be specified at the time the operator is created. |
760 | 761 | @param parameters: An object specifying the data, |
761 | 762 | and possible metadata, to be processed by the entity identifier. |
762 | 763 | @type parameters: L{DocumentParameters} or L{str} |
| 764 | + @param resolve_entities: Specifies whether or not linked entity information will |
| 765 | + be wanted. |
| 766 | + @type resolve_entities: Boolean |
763 | 767 | @return: A python dictionary containing the results of entity extraction.""" |
764 | | - return EndpointCaller(self, "entities").call(parameters) |
| 768 | + if resolve_entities: |
| 769 | + warnings.warn("entities(params,resolve_entities) is deprecated and replaced by entities(params).", DeprecationWarning) |
| 770 | + return EndpointCaller(self, "entities/linked").call(parameters) |
| 771 | + else: |
| 772 | + return EndpointCaller(self, "entities").call(parameters) |
765 | 773 |
|
766 | 774 | def categories(self, parameters): |
767 | 775 | """ |
|
0 commit comments