serial_monitor/src/DataAnalyzer/GenerateData.java
// returns word (w/o punctuation) of sentence at desired index

returns word (w/o punctuation) of sentence at desired index
returns word ( w / o punctuation ) of sentence at desired index
public static String sentenceToWord(String sentence, int index) {
        int a = 0, b = 1, num = 0;
        while (b < sentence.length()) {
        	if (sentence.charAt(b) != ' ') b++;
        	else {
        		String word = sentence.substring(a,b);
	        	if (!testByteChar((byte) word.charAt(word.length() - 1))) {
	        		word = word.substring(0, word.length() - 1);
	        		num++; 
	        	}
        		num += word.length() + 1; 
        		if (num >= index + 1) {
        			System.out.println(word);
        			return word;
        		}
        		else {
        		a = ++b;
        		b++;
        		}
        	}
        }
        if (index == sentence.length() - 1) return sentence.substring(a);
        else return sentence.substring(a, sentence.length() - 1);
	}
public static String sentenceToWord ( String sentence , int index ) { int a = 0 , b = 1 , num = 0 ; while ( b < sentence . length ( ) ) { if ( sentence . charAt ( b ) != ' ' ) b ++ ; else { String word = sentence . substring ( a , b ) ; if ( ! testByteChar ( ( byte ) word . charAt ( word . length ( ) - 1 ) ) ) { word = word . substring ( 0 , word . length ( ) - 1 ) ; num ++ ; } num += word . length ( ) + 1 ; if ( num >= index + 1 ) { System . out . println ( word ) ; return word ; } else { a = ++ b ; b ++ ; } } } if ( index == sentence . length ( ) - 1 ) return sentence . substring ( a ) ; else return sentence . substring ( a , sentence . length ( ) - 1 ) ; }
returns word (w/o punctuation) of sentence at desired index
returns word ( w / o punctuation ) of sentence at desired index
// scans through sentence and separates each word
 // removes last character if not a letter or number, adds to index
 // counteracts loss of punctuation
 // counteracts loss of space
 // returns last word, depending on index
