Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PropertiesTokenizer.cs
1using System;
3using System.Threading.Tasks;
10
12{
17 {
22 {
23 }
24
30 public Grade Supports(Type Type)
31 {
32 if (typeof(IEnumerable<Property>).IsAssignableFrom(Type))
33 return Grade.Ok;
34 else
35 return Grade.NotAtAll;
36 }
37
43 public Task Tokenize(object Value, TokenizationProcess Process)
44 {
45 if (Value is IEnumerable<Property> Properties)
46 Tokenize(Properties, Process);
47
48 return Task.CompletedTask;
49 }
50
57 public static void Tokenize(IEnumerable<Property> Properties, TokenizationProcess Process)
58 {
59 if (!(Properties is null))
60 {
61 foreach (Property Property in Properties)
62 {
64 Process.DocumentIndexOffset++;
65 }
66 }
67 }
68
73 public Task Prepare(string Definition)
74 {
75 return Task.CompletedTask;
76 }
77
83 public async Task<object> Evaluate(object Instance)
84 {
85 if (Instance is LegalIdentity Identity)
86 return Identity.Properties;
87 else if (Instance is GenericObject Obj)
88 {
89 if (Obj.TryGetFieldValue("Properties", out object Obj2) &&
90 Obj2 is Array A)
91 {
92 if (A.Length == 0)
93 return Array.Empty<Property>();
94
95 ChunkedList<Property> Properties = new ChunkedList<Property>(A.Length);
96
97 foreach (object Item in A)
98 {
99 if (Item is GenericObject GenProperty &&
100 await Database.Specialize(GenProperty) is Property Property)
101 {
102 Properties.Add(Property);
103 }
104 else if (Item is Property Property2)
105 Properties.Add(Property2);
106 }
107
108 return Properties;
109 }
110 }
111 else if (Instance is IEnumerable<Property> Properties)
112 return Properties;
113
114 return null;
115 }
116
117 }
118}
Static interface for database persistence. In order to work, a database provider has to be assigned t...
Definition: Database.cs:21
static Task< object > Specialize(GenericObject Object)
Creates a specialized representation of a generic object.
Definition: Database.cs:2483
Contains information about a tokenization process.
uint DocumentIndexOffset
Document Index Offset. Used to identify sequences of tokens in a document.
Generic object. Contains a sequence of properties.
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
Interface for full-text-search tokenizers
Definition: ITokenizer.cs:12
Grade
Grade enumeration
Definition: Grade.cs:7