Find Related Texts

To be able to find related texts you first need to upload the texts you want to match against. When you have uploaded your archive your texts will be indexed and structured by our engines in a way that makes it possible for us to automatically determine which texts are similar to each other. The indexing process is triggered when you do your first "related-texts" request and the complete indexing time may vary depending on how large your archive is.

Create your collection

See this as your text archive where you store all your texts that you want to be able to work on or search in.
Check out the collection.create method for how to create a collection.
You might want to read the topic site collection for more information about collections.

Add your texts to your collection

To be able to get related texts you need to add texts to your collection.
When a text is added it gets a unique id in that specific collection, which means that the compound key collection_id+text_id is globally unique. If you want to be able to refer to a text you have added or if you want to link it to a resource in your own system then you should store the generated id (it is always good to store both collection_id and text_id since you might use several collections).

If you rather want to use your own ids (e.g. you already have a unique id for the text) it is possible to provide that id and use that as a reference. A text is create using the method text.create.

Get related texts

After you have created your text collection and added texts to it, it's possible to get related texts.

When you wan to get related texts for a text (refered to as "source text") the "source text" also need to be a resource in Saplo API. To get related texts you use the method text.relatedTexts. You provide where your "source text" is stored (collection_id and text_id) and also in which collection(s) you want to search for related texts in.

Remember that the indexing process is triggered when you do your first "related-texts" request and the complete indexing time may vary depending on how large your archive is.

If any related texts where found they will be returned including a relevance value between 0 - 1, where 1 indicates that the text is an exact match compared to your "source text".

Remember to store your result locally. We don't recommend you do the lookups against Saplo API everytime you need a result.

Happy coding!