-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add create_synonym_map_from_file (#18811)
* add create_synonym_map_from_file * update * update
- Loading branch information
1 parent
03b6d21
commit f283843
Showing
6 changed files
with
36 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
USA, United States, United States of America | ||
Washington, Wash. => WA |
14 changes: 14 additions & 0 deletions
14
sdk/search/azure-search-documents/tests/test_synonym_map.py
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,14 @@ | ||
# ------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
# ------------------------------------ | ||
from os.path import dirname, join, realpath | ||
from azure.search.documents.indexes.models import SynonymMap | ||
|
||
def test_create_synonym_map_from_file(): | ||
CWD = dirname(realpath(__file__)) | ||
path = join(CWD, "synonym_map.txt") | ||
synonym_map = SynonymMap.create_from_file('test', path) | ||
assert len(synonym_map.synonyms) == 2 | ||
assert synonym_map.synonyms[0] == 'USA, United States, United States of America' | ||
assert synonym_map.synonyms[1] == 'Washington, Wash. => WA' |