Package etc.aloe.data

Examples of etc.aloe.data.MessageSet


            TrainOptions options = (TrainOptions) modeOptions;

            saveCommand(options.outputCommandFile);
           
            //Get and preprocess the data
            MessageSet messages = this.loadMessages(options.inputCSVFile);
            Segmentation segmentation = factory.constructSegmentation();
            SegmentSet segments = segmentation.segment(messages);

            //Set up a cross validation controller.
            CrossValidationController crossValidationController = new CrossValidationController();
View Full Code Here


            String messageStr = options.messageText;
            String participant = "stdin";
            Date time = new Date();

            MessageSet messages = new MessageSet();
            Message message = new Message(0, time, participant, messageStr);
            messages.add(message);

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

    public static void tearDownClass() {
    }

    @Before
    public void setUp() {
        this.rawMessages = new MessageSet();
        rawMessages.add(new Message(1, new Date(), "Alice", "Hello1"));
        rawMessages.add(new Message(2, new Date(), "Bob", "Hello2"));
        rawMessages.add(new Message(3, new Date(), "Alice", "Hello3"));
        rawMessages.add(new Message(4, new Date(), "Bob", "Hello4"));
        rawMessages.add(new Message(5, new Date(), "Alice", "Hello5"));
View Full Code Here

            //Provide implementations of the needed processes
            factory.configureLabeling(labelingController);

            //Process the input messages
            MessageSet messages = this.loadMessages(options.inputCSVFile);
            FeatureSpecification spec = this.loadFeatureSpecification(options.inputFeatureSpecFile);
            Model model = this.loadModel(options.inputModelFile);

            SegmentSet segments = segmentation.segment(messages);
View Full Code Here

            System.exit(1);
        }
    }

    protected MessageSet loadMessages(File inputCSVFile) {
        MessageSet messages = new MessageSet();
        messages.setDateFormat(factory.constructDateFormat());

        try {
            System.out.println("Reading messages from " + inputCSVFile);
            InputStream inputCSV = new FileInputStream(inputCSVFile);
            messages.load(inputCSV);
            inputCSV.close();
        } catch (FileNotFoundException e) {
            System.err.println("Input CSV file " + inputCSVFile + " not found.");
            System.exit(1);
        } catch (InvalidObjectException e) {
View Full Code Here

     * Test of segment method, of class NullSegmentation.
     */
    @Test
    public void testSegment() {
        System.out.println("segment");
        MessageSet messages = new MessageSet();

        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"));

        NullSegmentation instance = new NullSegmentation();
        SegmentSet segments = instance.segment(messages);

        //Expecting the same number of segments as messages
        assertEquals(messages.size(), segments.size());

        for (int i = 0; i < messages.size(); i++) {
            Message message = messages.get(i);
            Segment segment = segments.get(i);

            assertEquals(1, segment.getMessages().size());
            assertEquals(message, segment.getMessages().get(0));
        }
View Full Code Here

            interactiveController.run();

            System.out.println();
            System.out.println("== Saving Output ==");

            MessageSet messages = interactiveController.getMessageSet();
            messages.setDateFormat(factory.constructDateFormat());
            saveMessages(messages, options.outputCSVFile);
        } else {
            throw new IllegalArgumentException("Options must be for Interactive");
        }
    }
View Full Code Here

        System.out.println("== Interactive Mode ==");

        Scanner scan = new Scanner(System.in);

        messages = new MessageSet();

        int msgIdInc = 0;
        System.out.print("MSG > ");
        while (scan.hasNextLine()) {
View Full Code Here

     * Test of segment method, of class ThresholdSegmentation.
     */
    @Test
    public void testSegment_byTimeAndParticipant() {
        System.out.println("segment_byTimeAndParticipant");
        MessageSet messages = new MessageSet();

        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
        assertEquals(5, segments.size());

        Segment seg0 = segments.get(0);
        Segment seg1 = segments.get(1);
        Segment seg2 = segments.get(2);
        Segment seg3 = segments.get(3);
        Segment seg4 = segments.get(4);

        assertEquals(1, seg0.getMessages().size()); //Alice
        assertEquals(1, seg1.getMessages().size()); //Alice
        assertEquals(2, seg2.getMessages().size()); //Alice, Alice
        assertEquals(2, seg3.getMessages().size()); //Bob, Bob
        assertEquals(2, seg4.getMessages().size()); //Bob, Bob

        assertEquals(messages.get(0), seg0.getMessages().get(0));
        assertEquals(messages.get(5), seg1.getMessages().get(0));
        assertEquals(messages.get(6), seg2.getMessages().get(0));
        assertEquals(messages.get(1), seg3.getMessages().get(0));
        assertEquals(messages.get(3), seg4.getMessages().get(0));
    }
View Full Code Here

     * Test of segment method, of class ThresholdSegmentation.
     */
    @Test
    public void testSegment_byTime() {
        System.out.println("segment_byTime");
        MessageSet messages = new MessageSet();

        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
        assertEquals(4, segments.size());

        Segment seg0 = segments.get(0);
        Segment seg1 = segments.get(1);
        Segment seg2 = segments.get(2);
        Segment seg3 = segments.get(3);

        assertEquals(3, seg0.getMessages().size());
        assertEquals(2, seg1.getMessages().size());
        assertEquals(1, seg2.getMessages().size());
        assertEquals(2, seg3.getMessages().size());

        assertEquals(messages.get(0), seg0.getMessages().get(0));
        assertEquals(messages.get(3), seg1.getMessages().get(0));
        assertEquals(messages.get(5), seg2.getMessages().get(0));
        assertEquals(messages.get(6), seg3.getMessages().get(0));
    }
View Full Code Here

TOP

Related Classes of etc.aloe.data.MessageSet

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.