Package org.ggp.base.util.gdl.model

Examples of org.ggp.base.util.gdl.model.ImmutableSentenceFormModel


     * Removes rules with sentences with empty domains. These simply won't have
     * sentence forms in the generated sentence model, so this is fairly easy.
     * @throws InterruptedException
     */
    private static List<Gdl> cleanUpIrrelevantRules(List<Gdl> expandedRules) throws InterruptedException {
        final ImmutableSentenceFormModel model = SentenceFormModelFactory.create(expandedRules);
        return ImmutableList.copyOf(Collections2.filter(expandedRules, new Predicate<Gdl>() {
            @Override
            public boolean apply(Gdl input) {
                if (!(input instanceof GdlRule)) {
                    // If it's not a rule, leave it in
                    return true;
                }
                GdlRule rule = (GdlRule) input;
                // Used just as a boolean we can change from the inner class
                final AtomicBoolean shouldRemove = new AtomicBoolean(false);
                GdlVisitors.visitAll(rule, new GdlVisitor() {
                    @Override
                    public void visitSentence(GdlSentence sentence) {
                        SentenceForm form = model.getSentenceForm(sentence);
                        if (!model.getSentenceForms().contains(form)) {
                            shouldRemove.set(true);
                        }
                    }
                });
                return !shouldRemove.get();
View Full Code Here

TOP

Related Classes of org.ggp.base.util.gdl.model.ImmutableSentenceFormModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.