Package com.jgaap.generics

Examples of com.jgaap.generics.EventDriver


  @Test
  public void testCreateEventSetDocumentSet() throws EventGenerationException {

    String text = ("Hello, Dr. Jones!  I'm not.feeling.too well today.  What's the matter Mr. Adams?  My stomach hurts, or A.K.A, cramps.");

    EventDriver eventDriver = new FirstWordInSentenceEventDriver();
    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new EventSet();
    Vector<Event> tmp = new Vector<Event>();

    tmp.add(new Event("Hello,", eventDriver));
        tmp.add(new Event("I'm", eventDriver));
View Full Code Here


"AAAAA BBBBB CCCCC DDDDD EEEEE FFFFF GGGGG HHHHH IIIII JJJJJ KKKKK LLLLL MMMMM NNNNN OOOOO PPPPP QQQQQ RRRRR SSSSS TTTTT UUUUU VVVVV WWWWW XXXXX YYYYY ZZZZZ" +
"1 22 333 4444 55555 " +
"! @@ ### $$$$ %%%%% "
    );

    EventDriver eventDriver = new VowelMNLetterWordEventDriver();
    eventDriver.setParameter("M", 2);
    eventDriver.setParameter("N", 3);

    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new EventSet();
    Vector<Event> tmp = new Vector<Event>();

    tmp.add(new Event("aa", eventDriver));
    tmp.add(new Event("ee", eventDriver));
View Full Code Here

    /* test case 1 -- no punctuation */
    String text = (
"a aah Aaron aback abacus abandon abandoned zones zoning zoo " +
"zoologist zoology zoom zooming zooms zucchini Zurich");

    EventDriver eventDriver = new TruncatedNamingTimeEventDriver();
    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new NumericEventSet();
    Vector<Event> tmp = new Vector<Event>();

    tmp.add(new Event("66", eventDriver));
    tmp.add(new Event("64", eventDriver));
View Full Code Here

            "1 22 333 4444 55555 " +
            "! @@ ### $$$$ %%%%% " +
            "A BB CCC DDDD EEEEE " ;


    EventDriver eventDriver = new MNLetterWordEventDriver();
    eventDriver.setParameter("M", 2);
    eventDriver.setParameter("N", 3);
   
    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new EventSet();
    Vector<Event> tmp = new Vector<Event>();

    tmp.add(new Event("bb", eventDriver));
    tmp.add(new Event("ccc", eventDriver));
View Full Code Here

      /*HapaxLegomenaEventDriver - Returns only events that occurs once*/
      /*Test One - Normal Text w/ one event to return*/

    String text = ("The Quick Brown Fox Jumped Over The Lazy Dog 3 3 3 4 4 4 4 5 5 5 5 5");

      EventDriver eventDriver = new RareWordsEventDriver();
      eventDriver.setParameter("M", 1);
      eventDriver.setParameter("N", 1);
     
      EventSet sampleSet = eventDriver.createEventSet(text.toCharArray());
     
      EventSet expectedSet = new EventSet();
      Vector<Event> tmp = new Vector<Event>();
      tmp.add(new Event("Quick", eventDriver));
      tmp.add(new Event("Brown", eventDriver));
View Full Code Here

   * @throws EventGenerationException
   */
  @Test
  public void testCreateEventSetDocumentSet() throws EventGenerationException {
    String text = ("abcdefghijklmnopqrstuvwxyz .");
    EventDriver eventDriver = new CharacterNGramEventDriver();
    eventDriver.setParameter("N", 2);
    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new EventSet();
    Vector<Event> tmp = new Vector<Event>();
    tmp.add(new Event("ab", eventDriver));
    tmp.add(new Event("bc", eventDriver));
    tmp.add(new Event("cd", eventDriver));
View Full Code Here

   * @throws EventGenerationException
   */
  @Test
  public void testCreateEventSetDocumentSet() throws EventGenerationException {
    String text = ("abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz.");
    EventDriver eventDriver = new CharacterEventDriver();
    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new EventSet();
    Vector<Event> tmp = new Vector<Event>();
    tmp.add(new Event("a", eventDriver));
    tmp.add(new Event("b", eventDriver));
    tmp.add(new Event("c", eventDriver));
View Full Code Here

    String text = (
"Mary had a little lamb;\n" +
"Its fleece was white as snow.\n" +
"And everywhere that Mary went,\n" +
"The lamb was sure to go.");
    EventDriver eventDriver = new WordNGramEventDriver();
    eventDriver.setParameter("N", 3);
    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new EventSet();
    Vector<Event> tmp = new Vector<Event>();
    tmp.add(new Event("[Mary, had, a]", eventDriver));
    tmp.add(new Event("[had, a, little]", eventDriver));
    tmp.add(new Event("[a, little, lamb;]", eventDriver));
View Full Code Here

 
  public AbsoluteHistogram(Document document) {
    Builder<Event, Integer> histogramBuilder = ImmutableMap.builder();
    Builder<EventDriver, Integer> totalsBuilder = ImmutableMap.builder();
    for(Map.Entry<EventDriver, EventSet> eventSetEntry : document.getEventSets().entrySet()){
      EventDriver eventDriver = eventSetEntry.getKey();
      EventSet eventSet = eventSetEntry.getValue();
      totalsBuilder.put(eventDriver, eventSet.size());
      Multiset<Event> multiset = HashMultiset.create(eventSet);
      for(Entry<Event> entry : multiset.entrySet()){
        histogramBuilder.put(entry.getElement(),entry.getCount());
View Full Code Here

    /* test case 1 -- no punctuation */
    String text = (
"a aah Aaron aback abacus abandon abandoned zones zoning zoo " +
"zoologist zoology zoom zooming zooms zucchini Zurich");

    EventDriver eventDriver = new NamingTimeEventDriver();
    EventSet sampleEventSet = eventDriver.createEventSet(text.toCharArray());
    EventSet expectedEventSet = new NumericEventSet();
    Vector<Event> tmp = new Vector<Event>();


    tmp.add(new Event("662.09", eventDriver));
View Full Code Here

TOP

Related Classes of com.jgaap.generics.EventDriver

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.