I suggest you ...

Need help with how to use CategoryFilters creating using the /classify/create_category_filter endpoint to classify text

Need help with how to use CategoryFilters creating using the /classify/create_category_filter endpoint to classify text. Once the filters are created how can a text document be tested against each one to determine which category the text belongs to.

1 vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    ncase shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    completed  ·  AdminTechnical Team (Admin, Cortical.io) responded  · 

    Hi ncase,

    In order to classify a new document, you should create the semantic representation of the document and compare it to the each of the filters.

    You have probably already figured out that the /text endpoint can be used for getting the semantic positions for a text, and that you can obtain the same by using the /expressions endpoint by putting the input as {"text": “Here is a the text content”}.

    In the /compare endpoint you can compare entities formatted in our syntax as for example:
    [
    {
    “positions”: [3, 5, 25, 26, … , 15894]
    },
    {
    “text”: “Gustav Klimt was born in Baumgarten, near Vienna in Austria-Hungary, the second of seven children”
    }
    ]

    so you could put the positions of one filter there as well as the new text (or the semantic representation of that new text).

    The endpoint /compare/bulk will take a list of such expression pairs (please find the json format example next to the endpoint) to compare, and return a list of Metric objects, so you could compare the new text with all categories on one http request. The most similar class would be the one with the smallest distance or the highest similarity – you can for example use the cosineSimilarity.

    Best regards
    Peter

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Anonymous commented  ·   ·  Flag as inappropriate

        Thanks for this answer. At least for me, it was not clear that positions/fingerprints could be compared to texts and terms, as the API demo only showed that you could compare text and terms. If this could be changed in the demo and documentation, this has the potential to save others from wasting their time trying to figure out what to do with fingerprints once they have them.

      Feedback and Knowledge Base