Skip to content

Commit 612b8ba

Browse files
committed
feat(compare comply): ClassifyReturn model updates
1 parent a20c81e commit 612b8ba

File tree

1 file changed

+63
-38
lines changed

1 file changed

+63
-38
lines changed

ibm_watson/compare_comply_v1.py

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,42 +1601,49 @@ def __init__(self,
16011601
by the value of the `model_id` key.
16021602
:param list[Element] elements: (optional) Document elements identified by the
16031603
service.
1604-
:param list[Tables] tables: (optional) Definition of tables identified in the
1605-
input document.
1606-
:param DocStructure document_structure: (optional) The structure of the input
1607-
document.
1608-
:param list[Parties] parties: (optional) Definitions of the parties identified in
1609-
the input document.
16101604
:param list[EffectiveDates] effective_dates: (optional) The date or dates on which
16111605
the document becomes effective.
16121606
:param list[ContractAmts] contract_amounts: (optional) The monetary amounts that
16131607
identify the total amount of the contract that needs to be paid from one party to
16141608
another.
16151609
:param list[TerminationDates] termination_dates: (optional) The date or dates on
16161610
which the document is to be terminated.
1617-
:param list[ContractType] contract_type: (optional) The document's contract type
1611+
:param list[ContractTypes] contract_types: (optional) The document's contract type
16181612
or types as declared in the document.
1613+
:param list[ContractTerms] contract_terms: (optional) The duration or durations of
1614+
the contract.
1615+
:param list[PaymentTerms] payment_terms: (optional) The document's payment
1616+
duration or durations.
1617+
:param list[Tables] tables: (optional) Definition of tables identified in the
1618+
input document.
1619+
:param DocStructure document_structure: (optional) The structure of the input
1620+
document.
1621+
:param list[Parties] parties: (optional) Definitions of the parties identified in
1622+
the input document.
16191623
"""
16201624
self.document = document
16211625
self.model_id = model_id
16221626
self.model_version = model_version
16231627
self.elements = elements
1624-
self.tables = tables
1625-
self.document_structure = document_structure
1626-
self.parties = parties
16271628
self.effective_dates = effective_dates
16281629
self.contract_amounts = contract_amounts
16291630
self.termination_dates = termination_dates
1630-
self.contract_type = contract_type
1631+
self.contract_types = contract_types
1632+
self.contract_terms = contract_terms
1633+
self.payment_terms = payment_terms
1634+
self.tables = tables
1635+
self.document_structure = document_structure
1636+
self.parties = parties
16311637

16321638
@classmethod
16331639
def _from_dict(cls, _dict):
16341640
"""Initialize a ClassifyReturn object from a json dictionary."""
16351641
args = {}
16361642
validKeys = [
1637-
'document', 'model_id', 'model_version', 'elements', 'tables',
1638-
'document_structure', 'parties', 'effective_dates',
1639-
'contract_amounts', 'termination_dates', 'contract_type'
1643+
'document', 'model_id', 'model_version', 'elements',
1644+
'effective_dates', 'contract_amounts', 'termination_dates',
1645+
'contract_types', 'contract_terms', 'payment_terms', 'tables',
1646+
'document_structure', 'parties'
16401647
]
16411648
badKeys = set(_dict.keys()) - set(validKeys)
16421649
if badKeys:
@@ -1653,17 +1660,6 @@ def _from_dict(cls, _dict):
16531660
args['elements'] = [
16541661
Element._from_dict(x) for x in (_dict.get('elements'))
16551662
]
1656-
if 'tables' in _dict:
1657-
args['tables'] = [
1658-
Tables._from_dict(x) for x in (_dict.get('tables'))
1659-
]
1660-
if 'document_structure' in _dict:
1661-
args['document_structure'] = DocStructure._from_dict(
1662-
_dict.get('document_structure'))
1663-
if 'parties' in _dict:
1664-
args['parties'] = [
1665-
Parties._from_dict(x) for x in (_dict.get('parties'))
1666-
]
16671663
if 'effective_dates' in _dict:
16681664
args['effective_dates'] = [
16691665
EffectiveDates._from_dict(x)
@@ -1679,9 +1675,30 @@ def _from_dict(cls, _dict):
16791675
TerminationDates._from_dict(x)
16801676
for x in (_dict.get('termination_dates'))
16811677
]
1682-
if 'contract_type' in _dict:
1683-
args['contract_type'] = [
1684-
ContractType._from_dict(x) for x in (_dict.get('contract_type'))
1678+
if 'contract_types' in _dict:
1679+
args['contract_types'] = [
1680+
ContractTypes._from_dict(x)
1681+
for x in (_dict.get('contract_types'))
1682+
]
1683+
if 'contract_terms' in _dict:
1684+
args['contract_terms'] = [
1685+
ContractTerms._from_dict(x)
1686+
for x in (_dict.get('contract_terms'))
1687+
]
1688+
if 'payment_terms' in _dict:
1689+
args['payment_terms'] = [
1690+
PaymentTerms._from_dict(x) for x in (_dict.get('payment_terms'))
1691+
]
1692+
if 'tables' in _dict:
1693+
args['tables'] = [
1694+
Tables._from_dict(x) for x in (_dict.get('tables'))
1695+
]
1696+
if 'document_structure' in _dict:
1697+
args['document_structure'] = DocStructure._from_dict(
1698+
_dict.get('document_structure'))
1699+
if 'parties' in _dict:
1700+
args['parties'] = [
1701+
Parties._from_dict(x) for x in (_dict.get('parties'))
16851702
]
16861703
return cls(**args)
16871704

@@ -1696,14 +1713,6 @@ def _to_dict(self):
16961713
_dict['model_version'] = self.model_version
16971714
if hasattr(self, 'elements') and self.elements is not None:
16981715
_dict['elements'] = [x._to_dict() for x in self.elements]
1699-
if hasattr(self, 'tables') and self.tables is not None:
1700-
_dict['tables'] = [x._to_dict() for x in self.tables]
1701-
if hasattr(
1702-
self,
1703-
'document_structure') and self.document_structure is not None:
1704-
_dict['document_structure'] = self.document_structure._to_dict()
1705-
if hasattr(self, 'parties') and self.parties is not None:
1706-
_dict['parties'] = [x._to_dict() for x in self.parties]
17071716
if hasattr(self,
17081717
'effective_dates') and self.effective_dates is not None:
17091718
_dict['effective_dates'] = [
@@ -1719,8 +1728,24 @@ def _to_dict(self):
17191728
_dict['termination_dates'] = [
17201729
x._to_dict() for x in self.termination_dates
17211730
]
1722-
if hasattr(self, 'contract_type') and self.contract_type is not None:
1723-
_dict['contract_type'] = [x._to_dict() for x in self.contract_type]
1731+
if hasattr(self, 'contract_types') and self.contract_types is not None:
1732+
_dict['contract_types'] = [
1733+
x._to_dict() for x in self.contract_types
1734+
]
1735+
if hasattr(self, 'contract_terms') and self.contract_terms is not None:
1736+
_dict['contract_terms'] = [
1737+
x._to_dict() for x in self.contract_terms
1738+
]
1739+
if hasattr(self, 'payment_terms') and self.payment_terms is not None:
1740+
_dict['payment_terms'] = [x._to_dict() for x in self.payment_terms]
1741+
if hasattr(self, 'tables') and self.tables is not None:
1742+
_dict['tables'] = [x._to_dict() for x in self.tables]
1743+
if hasattr(
1744+
self,
1745+
'document_structure') and self.document_structure is not None:
1746+
_dict['document_structure'] = self.document_structure._to_dict()
1747+
if hasattr(self, 'parties') and self.parties is not None:
1748+
_dict['parties'] = [x._to_dict() for x in self.parties]
17241749
return _dict
17251750

17261751
def __str__(self):

0 commit comments

Comments
 (0)