Package etc.aloe.data

Examples of etc.aloe.data.Message


    public void testExtractFeatures() {
        System.out.println("extractFeatures");
        SegmentSet segments = new SegmentSet();

        Segment seg0 = new Segment();
        seg0.add(new Message(0, new Date(), "Alice", "it's"));
        seg0.add(new Message(1, new Date(), "Bob", "cow"));
        seg0.add(new Message(2, new Date(), "Alice", "time"));
        seg0.setTrueLabel(Boolean.TRUE);
        segments.add(seg0);

        Segment seg1 = new Segment();
        seg1.add(new Message(3, new Date(), "Bob", "noooooooo"));
        seg1.setTrueLabel(Boolean.FALSE);
        segments.add(seg1);

        Segment seg2 = new Segment();
        seg2.add(new Message(4, new Date(), "Bob", "once"));
        seg2.add(new Message(5, new Date(), "Alice", "upon"));
        seg2.setTrueLabel(Boolean.FALSE);
        segments.add(seg2);

        Segment seg3 = new Segment();
        seg3.add(new Message(6, new Date(), "Bob", "a"));
        seg3.add(new Message(7, new Date(), "Alice", "time"));
        seg3.setTrueLabel(Boolean.TRUE);
        segments.add(seg3);

        Instances basicInstances = segments.getBasicExamples().getInstances();
View Full Code Here


            String messageStr = scan.nextLine();
            String participant = "user";
            Date time = new Date();

            Message message = new Message(msgIdInc++, time, participant, messageStr);
            messages.add(message);

            //Make a segment for the message
            Segment segment = new Segment();
            segment.add(message);
            SegmentSet segmentSet = new SegmentSet();
            segmentSet.add(segment);

            //First extract features
            FeatureExtraction extraction = getFeatureExtractionImpl();
            extraction.setVerbosity(Loggable.Verbosity.Quiet);

            ExampleSet examples = extraction.extractFeatures(segmentSet.getBasicExamples(), featureSpecification);

            //Predict the labels
            Predictions prediction = this.model.getPredictions(examples);

            //Map back onto messages
            LabelMapping mapping = getMappingImpl();
            mapping.map(prediction, segmentSet);


            //Print out the label
            System.out.println("Predicted label: " + message.getPredictedLabel());
            System.out.println();
            System.out.print("MSG >");
        }
    }
View Full Code Here

        long now = new Date().getTime();
        long second = 1 * 1000;
        long minute = 60 * 1000;

        messages.add(new Message(0, new Date(now), "Alice", "it's"));
        messages.add(new Message(1, new Date(now + second), "Bob", "cow"));
        messages.add(new Message(2, new Date(now + 2 * second), "Bob", "time"));
        messages.add(new Message(3, new Date(now + minute), "Bob", "noooooooo"));
        messages.add(new Message(4, new Date(now + minute + second), "Bob", "once"));
        messages.add(new Message(5, new Date(now + 2 * minute), "Alice", "upon"));
        messages.add(new Message(6, new Date(now + 3 * minute), "Alice", "a"));
        messages.add(new Message(7, new Date(now + 3 * minute + second), "Alice", "time"));

        ThresholdSegmentation instance = new ThresholdSegmentation(30, true);
        SegmentSet segments = instance.segment(messages);

        //Expecting 5 segments
View Full Code Here

        long now = new Date().getTime();
        long second = 1 * 1000;
        long minute = 60 * 1000;

        messages.add(new Message(0, new Date(now), "Alice", "it's"));
        messages.add(new Message(1, new Date(now + second), "Bob", "cow"));
        messages.add(new Message(2, new Date(now + 2 * second), "Alice", "time"));
        messages.add(new Message(3, new Date(now + minute), "Bob", "noooooooo"));
        messages.add(new Message(4, new Date(now + minute + second), "Bob", "once"));
        messages.add(new Message(5, new Date(now + 2 * minute), "Alice", "upon"));
        messages.add(new Message(6, new Date(now + 3 * minute), "Bob", "a"));
        messages.add(new Message(7, new Date(now + 3 * minute + second), "Alice", "time"));

        ThresholdSegmentation instance = new ThresholdSegmentation(30, false);
        SegmentSet segments = instance.segment(messages);

        //Expecting 4 segments
View Full Code Here

    @Test
    public void testSegment_byParticipant() {
        System.out.println("segment_byParticipant");
        MessageSet messages = new MessageSet();

        messages.add(new Message(0, new Date(), "Alice", "it's"));
        messages.add(new Message(1, new Date(), "Bob", "cow"));
        messages.add(new Message(2, new Date(), "Alice", "time"));
        messages.add(new Message(3, new Date(), "Bob", "noooooooo"));
        messages.add(new Message(4, new Date(), "Bob", "once"));
        messages.add(new Message(5, new Date(), "Alice", "upon"));
        messages.add(new Message(6, new Date(), "Bob", "a"));
        messages.add(new Message(7, new Date(), "Alice", "time"));

        ThresholdSegmentation instance = new ThresholdSegmentation(30, true);
        SegmentSet segments = instance.segment(messages);

        //Expecting 2 segments, one for each participant
View Full Code Here

    @Test
    public void testSegment_notByParticipant() {
        System.out.println("segment_notByParticipant");
        MessageSet messages = new MessageSet();

        messages.add(new Message(0, new Date(), "Alice", "it's"));
        messages.add(new Message(1, new Date(), "Bob", "cow"));
        messages.add(new Message(2, new Date(), "Alice", "time"));
        messages.add(new Message(3, new Date(), "Bob", "noooooooo"));
        messages.add(new Message(4, new Date(), "Bob", "once"));
        messages.add(new Message(5, new Date(), "Alice", "upon"));
        messages.add(new Message(6, new Date(), "Bob", "a"));
        messages.add(new Message(7, new Date(), "Alice", "time"));

        ThresholdSegmentation instance = new ThresholdSegmentation(30, false);
        SegmentSet segments = instance.segment(messages);

        //Expecting 1 segment
        assertEquals(1, segments.size());

        Segment seg0 = segments.get(0);

        assertEquals(8, seg0.getMessages().size());

        for (int i = 0; i < seg0.getMessages().size(); i++) {
            Message message = seg0.getMessages().get(i);
            Message expectedMessage = seg0.getMessages().get(i);
            assertEquals(expectedMessage, message);
        }
    }
View Full Code Here

TOP

Related Classes of etc.aloe.data.Message

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.