neurolang.frontend.drs.chart_parser module

class neurolang.frontend.drs.chart_parser.Chart(iterable=(), /)

Bases: list

Methods

append(object, /)

Append object to the end of the list.

clear(/)

Remove all items from list.

copy(/)

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

index(value[, start, stop])

Return first index of value.

insert(index, object, /)

Insert object before index.

pop([index])

Remove and return item at index (default last).

remove(value, /)

Remove first occurrence of value.

reverse(/)

Reverse IN PLACE.

sort(*[, key, reverse])

Sort the list in ascending order and return None.

class neurolang.frontend.drs.chart_parser.ChartParser(grammar, lexicon)

Bases: object

Methods

Edge(head, rule, completed, remaining, ...)

Attributes:

parse

recognize

class Edge(head, rule, completed, remaining, used_edges, unification)

Bases: tuple

Attributes:
completed

Alias for field number 2

head

Alias for field number 0

remaining

Alias for field number 3

rule

Alias for field number 1

unification

Alias for field number 5

used_edges

Alias for field number 4

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

completed

Alias for field number 2

head

Alias for field number 0

remaining

Alias for field number 3

rule

Alias for field number 1

unification

Alias for field number 5

used_edges

Alias for field number 4

parse(string)
recognize(string)
class neurolang.frontend.drs.chart_parser.DictLexicon(d)

Bases: Lexicon

Convenience implementation of lexicon over dict

Methods

get_meanings

get_meanings(token)
class neurolang.frontend.drs.chart_parser.Grammar(rules)

Bases: Expression

Methods

__call__(*args, **kwargs)

Call self as a function.

apply(*args)

Builds a new expression using a tuple of its parameters

type

unapply()

Returns a tuple of parameters used to build the expression.

cast

change_type

get_wrapped_attribute

type = typing.Any
class neurolang.frontend.drs.chart_parser.Lexicon

Bases: object

Methods

get_meanings

get_meanings(word)
class neurolang.frontend.drs.chart_parser.RootRule(head, constituents)

Bases: Rule

Methods

__call__(*args, **kwargs)

Call self as a function.

apply(*args)

Builds a new expression using a tuple of its parameters

type

unapply()

Returns a tuple of parameters used to build the expression.

cast

change_type

get_wrapped_attribute

type = typing.Any
class neurolang.frontend.drs.chart_parser.Rule(head, constituents)

Bases: Expression

Methods

__call__(*args, **kwargs)

Call self as a function.

apply(*args)

Builds a new expression using a tuple of its parameters

type

unapply()

Returns a tuple of parameters used to build the expression.

cast

change_type

get_wrapped_attribute

type = typing.Any
class neurolang.frontend.drs.chart_parser.Tokenizer(grammar, quotes=['`', '"'])

Bases: object

Methods

next_token

tokenize

yield_comma

yield_quote

yield_word

next_token(text)
tokenize(string)
yield_comma(span)
yield_quote(q)
yield_word(span)