Skip to content

Pattern

Introduction

Lettria uses NLP techniques and predefined rules to identify patterns in text data. This process involves extracting metadata such as word choice, syntax, and other linguistic features, to apply to a set of rules to identify patterns or trends.

You can use this for:

  • Classifying relevant documents based on specific keywords or phrases, for example ranking documents with certain phrases higher in search results
  • Classifying text in categories or classes, for example sentiment analysis or emotion detection

Format

KeyTypeDescription
metadataMetadataMetadata
patternsPattern [ ]Patterns

Example

{
	"metadata": { "stats": { "label example": 1 } },
	"patterns": [
		{
			"id": "6087c69cbc96405b4517753b",
			"name": "label example",
			"label": "label example",
			"tokens": [
				{
					"source": "Victor",
					"sentence": 0,
					"index": 0,
					"source_indexes": [0, 6],
					"tags": [{ "name": "tag 1" }]
				}
			]
		}
	]
}

Metadata

Metadata Format

TypeDescription
statsobjectStats

Metadata Example

{
	"stats": { "label example": 1 }
}

Patterns

Pattern Format

KeyTypeDescription
idStringID
nameStringName
labelStringLabel
tokensToken [ ]Tokens

Pattern Example

{
	"id": "6087c69cbc96405b4517753b",
	"name": "label example",
	"label": "label example",
	"tokens": [
		{
			"source": "Victor",
			"sentence": 0,
			"index": 0,
			"source_indexes": [0, 6],
			"tags": [{ "name": "tag 1" }]
		}
	]
}

Token

Token Format
KeyTypeDescription
sourceStringSource
sentenceNumberSentence
indexNumberIndex
source_indexesNumber [ ]Source indexes
tagsTag [ ]Tags
Token Example
{
	"source": "Victor",
	"sentence": 0,
	"index": 0,
	"source_indexes": [0, 6],
	"tags": [{ "name": "tag 1" }]
}
Tag
Tag Format
KeyTypeDescription
nameStringName
Tag Example
{ "name": "tag 1" }

Next steps