-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
230 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Example code to call Rosette API to get similarity score between a list of records | ||
""" | ||
|
||
import argparse | ||
import json | ||
import os | ||
|
||
from rosette.api import API, RecordSimilarityParameters, RosetteException | ||
|
||
|
||
def run(key, alt_url='https://api.rosette.com/rest/v1/'): | ||
""" Run the example """ | ||
# Create an API instance | ||
api = API(user_key=key, service_url=alt_url) | ||
|
||
fields = { | ||
"primaryName": { | ||
"type": "rni_name", | ||
"weight": 0.5 | ||
}, | ||
"dob": { | ||
"type": "rni_date", | ||
"weight": 0.2 | ||
}, | ||
"addr": { | ||
"type": "rni_address", | ||
"weight": 0.5 | ||
}, | ||
"dob2": { | ||
"type": "rni_date", | ||
"weight": 0.1 | ||
} | ||
} | ||
properties = { | ||
"threshold": 0.7, | ||
"includeExplainInfo": True | ||
} | ||
records = { | ||
"left": [ | ||
{ | ||
"primaryName": { | ||
"text": "Ethan R", | ||
"entityType": "PERSON", | ||
"language": "eng", | ||
"languageOfOrigin": "eng", | ||
"script": "Latn" | ||
}, | ||
"dob": "1993-04-16", | ||
"addr": "123 Roadlane Ave", | ||
"dob2": { | ||
"date": "1993/04/16" | ||
} | ||
}, | ||
{ | ||
"dob": { | ||
"date": "1993-04-16" | ||
}, | ||
"primaryName": { | ||
"text": "Evan R" | ||
} | ||
} | ||
], | ||
"right": [ | ||
{ | ||
"dob": { | ||
"date": "1993-04-16" | ||
}, | ||
"primaryName": { | ||
"text": "Seth R", | ||
"language": "eng" | ||
} | ||
}, | ||
{ | ||
"primaryName": "Ivan R", | ||
"dob": { | ||
"date": "1993-04-16" | ||
}, | ||
"addr": { | ||
"address": "123 Roadlane Ave" | ||
}, | ||
"dob2": { | ||
"date": "1993/04/16" | ||
} | ||
} | ||
] | ||
} | ||
params = RecordSimilarityParameters() | ||
params["fields"] = fields | ||
params["properties"] = properties | ||
params["records"] = records | ||
|
||
try: | ||
return api.record_similarity(params) | ||
except RosetteException as exception: | ||
print(exception) | ||
|
||
|
||
PARSER = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, | ||
description='Calls the ' + | ||
os.path.splitext(os.path.basename(__file__))[0] + ' endpoint') | ||
PARSER.add_argument('-k', '--key', help='Rosette API Key', required=True) | ||
PARSER.add_argument('-u', '--url', help="Alternative API URL", | ||
default='https://api.rosette.com/rest/v1/') | ||
|
||
if __name__ == '__main__': | ||
ARGS = PARSER.parse_args() | ||
RESULT = run(ARGS.key, ARGS.url) | ||
print(RESULT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
limitations under the License. | ||
""" | ||
|
||
__version__ = '1.28.0' | ||
__version__ = '1.29.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters