Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim max number of allowed disjuncts. #1483

Merged
merged 5 commits into from
Mar 27, 2024
Merged

Conversation

linas
Copy link
Member

@linas linas commented Mar 27, 2024

Some Atomese dictionaries specify far too many disjuncts: one recent case has a billion (! with a b) in the left-wall (discussion #1479) This is due to a faulty construction of the dictionary, but controlling this is difficult. By contrast, it is easy to control at the link-grammar level. That's what this pull req does.

Disjuncts are selected randomly, up to the max number. This is a reasonable thing to do, as almost all disjuncts are going to give a valid parse, anyway, so there was never any "real reason" for the dictionary to have had that many. So it goes.

The max number is handled as a parse option, but it is up to the dictionary to provide a default value.

Some badly-formed AtomSpace dicts can generate a billion(!)
disjuncts, which is impractical for practical applications.
The max-disjuncts to use will typically be deictionary-dependent.
But it behaves like a parse option, controlling parsing. So the
dictionary provides a default. Use can over-ride at run-time, if
they really want to.
@linas linas merged commit 3b0ca1e into opencog:master Mar 27, 2024
1 check passed
@linas linas deleted the stochastic-trim branch March 27, 2024 22:41
@ampli
Copy link
Member

ampli commented Apr 23, 2024

More than 2G disjuncts will create a problem anyway, due to rand_r(). More than 4G will crash the library because the disjunct number variable is unsigned int. But I'm not sure we need to add tests for that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants