Exemplo n.º 1
0
        public void AssertParseMethod033()
        {
            // Arrange
            const string text = @"coLd woRk Permits signEd five days ago.";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "type", -1), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "coLd", 0),
                        CreateToken(TokenKind.None, "woRk", 1),
                    }),
                    new AttributeDefinition(Create(TokenKind.None, "signEd", 3), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "five", 4),
                        CreateToken(TokenKind.None, "days", 5),
                        CreateToken(TokenKind.None, "ago", 6),
                    }),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public string Get([FromUri] string query)
        {
            var sentences       = SentenceParser.Parse(new Parser(query));
            var queryDefinition = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            return(JsonConvert.SerializeObject(QueryDefinitionToInfoConverter.Convert(queryDefinition)));
        }
Exemplo n.º 3
0
        public void AssertParseMethod042()
        {
            // Arrange
            const string text = @"Awaiting authorization permits with work Description ""Some description"".";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "state", -1), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "Awaiting", 0),
                        CreateToken(TokenKind.None, "authorization", 1),
                    }),
                    new AttributeDefinition(new MultipartToken
                    {
                        CreateToken(TokenKind.None, "work", 4),
                        CreateToken(TokenKind.None, "Description", 5),
                    }, Create(TokenKind.None, "\"Some description\"", 6)),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void AssertParseMethod003()
        {
            // Arrange
            const string text = @"Permits with title ""Some Title"" signed by evision and in state ""c""";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "title", 2), Create(TokenKind.None, "\"Some Title\"", 3)),
                    new AttributeDefinition(new MultipartToken
                    {
                        CreateToken(TokenKind.None, "signed", 4),
                        CreateToken(TokenKind.Owner, "by", 5),
                    }, Create(TokenKind.None, "evision", 6)),
                    new AttributeDefinition(Create(TokenKind.None, "state", 9), Create(TokenKind.None, "\"c\"", 10)),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public void AssertParseMethod018()
        {
            // Arrange
            const string text = @"permits of type Cold worK .";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "type", 2), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "Cold", 3),
                        CreateToken(TokenKind.None, "worK", 4),
                    }),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void AssertParseMethod041()
        {
            // Arrange
            const string text = @"awaiting authorization Isolations signEd one year ago titled a.";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "isolation",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "state", -1), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "awaiting", 0),
                        CreateToken(TokenKind.None, "authorization", 1),
                    }),
                    new AttributeDefinition(Create(TokenKind.None, "signEd", 3), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "one", 4),
                        CreateToken(TokenKind.None, "year", 5),
                        CreateToken(TokenKind.None, "ago", 6),
                    }),
                    new AttributeDefinition(Create(TokenKind.None, "titled", 7), Create(TokenKind.None, "a", 8)),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 7
0
        public void AssertParseMethod034()
        {
            // Arrange
            const string text = @"awaiting authorization Permits signEd last week.";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "state", -1), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "awaiting", 0),
                        CreateToken(TokenKind.None, "authorization", 1),
                    }),
                    new AttributeDefinition(Create(TokenKind.None, "signEd", 3), new MultipartToken
                    {
                        CreateToken(TokenKind.None, "last", 4),
                        CreateToken(TokenKind.None, "week", 5),
                    }),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 8
0
        public void AssertParseMethod002()
        {
            // Arrange
            const string text = @"Permit created yesterday.";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "created", 1), Create(TokenKind.None, "yesterday", 2)),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 9
0
        public void AssertParseMethod016()
        {
            // Arrange
            const string text = @"Draft Permit SiGned today.";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "state", -1), Create(TokenKind.None, "Draft", 0)),
                    new AttributeDefinition(Create(TokenKind.None, "SiGned", 2), Create(TokenKind.None, "today", 3)),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 10
0
        public void AssertParseMethod009()
        {
            // Arrange
            const string text = @"Permits titled ""Another title"" in state draft";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "titled", 1), Create(TokenKind.None, "\"Another title\"", 2)),
                    new AttributeDefinition(Create(TokenKind.None, "state", 4), Create(TokenKind.None, "draft", 5)),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }
Exemplo n.º 11
0
        public void AssertParseMethod008()
        {
            // Arrange
            const string text = @"Permits signed with state xxx!";

            var sentences = SentenceParser.Parse(new Parser(text));

            // Act
            var actual = EvisionLanguageProcessor.Processor.Parse(sentences.First());

            // Assert
            var expected = new QueryDefinition
            {
                Target     = "permit",
                Properties = new List <AttributeDefinition>
                {
                    new AttributeDefinition(Create(TokenKind.None, "signed", 1), Create(TokenKind.None, "true", -1)),
                    new AttributeDefinition(Create(TokenKind.None, "state", 3), Create(TokenKind.None, "xxx", 4)),
                },
            };

            Axiom.AssertAreEqual(expected, actual);
        }