Example #1
0
def simple_analyze_text():
    # [START simple_analyze_text]
    from azure.core.credentials import AzureKeyCredential
    from azure.search.documents.indexes import SearchIndexClient
    from azure.search.documents.indexes.models import AnalyzeTextOptions

    client = SearchIndexClient(service_endpoint, AzureKeyCredential(key))

    analyze_request = AnalyzeTextOptions(text="One's <two/>",
                                         analyzer_name="standard.lucene")

    result = client.analyze_text(index_name, analyze_request)
    print(result.as_dict())
 def test_analyze_text(self, api_key, endpoint, index_name, **kwargs):
     client = SearchIndexClient(endpoint, AzureKeyCredential(api_key))
     analyze_request = AnalyzeTextOptions(text="One's <two/>",
                                          analyzer_name="standard.lucene")
     result = client.analyze_text(index_name, analyze_request)
     assert len(result.tokens) == 2