Package com.quui.chat.mind

Examples of com.quui.chat.mind.Topic


                    throw new Exception(
                            "topics-file contains faulty <chat-answer>-elements (missing frequency-attributes)");
                }
            }
            Vector<String> k = new Vector<String>();
            Topic topic = new Topic(name, k, a);
            for (Iterator iter = keys.iterator(); iter.hasNext();) {
                Element element = (Element) iter.next();
                String key = element.getText();
                k.add(key);
View Full Code Here


    public Document createDOM(Map<String, Vector<Integer>> map,
            Vector<Topic> topics) throws ParserConfigurationException {
        Element mapNode = new Element("chat-map");
        Document doc = new Document(mapNode);
        for (int i = 0; i < topics.size(); i++) {
            Topic t = (Topic) topics.elementAt(i);
            Element topicNode = new Element("chat-topic");
            topicNode.setAttribute(new Attribute("name", t.getName()));
            mapNode.addContent(topicNode);
            // keys
            Iterator keys = t.getKeys().iterator();
            Element keysElem = new Element("chat-keys");
            topicNode.addContent(keysElem);
            while (keys.hasNext()) {
                String keyText = (String) keys.next();
                Element keyNode = new Element("chat-key");
                keysElem.addContent(keyNode);
                keyNode.setText(keyText);
            }
            // answers in a mapping with the answers as keys and their
            // frequencies as Integers as values
            Map answersMapping = t.getAnswers();
            Iterator answers = answersMapping.keySet().iterator();
            Element answersElem = new Element("chat-answers");
            topicNode.addContent(answersElem);
            while (answers.hasNext()) {
                String answerText = "";
View Full Code Here

        for (Iterator iterator = parents.iterator(); iterator.hasNext();) {
            String parent = (String) iterator.next();
            topicsArray = mind.findTopics(parent);
            if (topicsArray != null) {
                for (int i = 0; i < topicsArray.length; i++) {
                    Topic result = topicsArray[i];
                    if (result != null) {
                        double d = (double) Scoring.checkSimple(parents,
                                result, isWordNetEnabled)
                                / (double) rawWordCount;
                        result.setScore(d);
                        if (result.getScore() > maxScore) {
                            maxScore = result.getScore();
                            Log.logger
                                    .debug("[found new best topic in parents: "
                                            + result.getName()
                                            + " with score: " + maxScore);
                            return result;

                        }
                    }
View Full Code Here

            for (int j = 0; j < w.length; j++) {
                String syn = w[j].getLemma();
                Topic[] topicsArray = mind.findTopics(syn);
                if (topicsArray != null) {
                    for (int i = 0; i < topicsArray.length; i++) {
                        Topic result = topicsArray[i];
                        if (result != null) {
                            // TODO aha hier ambig... das nochmal durchdenken...
                            double d = (double) Scoring
                                    .checkAmbig(syns, result)
                                    / (double) rawWordCount;
                            result.setScore(d);
                            if (result.getScore() > maxScore) {
                                Log.logger
                                        .debug("[found new best topic in synonymes: "
                                                + result.getName()
                                                + " with score: " + maxScore);

                                return result;

                            }
View Full Code Here

        for (Iterator iterator = children.iterator(); iterator.hasNext();) {
            String child = (String) iterator.next();
            topicsArray = mind.findTopics(child);
            if (topicsArray != null) {
                for (int i = 0; i < topicsArray.length; i++) {
                    Topic result = topicsArray[i];
                    if (result != null) {
                        double d = (double) Scoring.checkSimple(children,
                                result, isWordNetEnabled)
                                / (double) rawWordCount;
                        result.setScore(d);
                        if (result.getScore() > maxScore) {
                            maxScore = result.getScore();
                            Log.logger
                                    .debug("[found new best topic in children: "
                                            + result.getName()
                                            + " with score: " + maxScore);

                            return result;

                        }
View Full Code Here

TOP

Related Classes of com.quui.chat.mind.Topic

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.