slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Text mining- text analytics- data mining PowerPoint Presentation
Download Presentation
Text mining- text analytics- data mining

Text mining- text analytics- data mining

265 Views Download Presentation
Download Presentation

Text mining- text analytics- data mining

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Text mining- text analytics- data mining Text mining, also referred to as text data mining, roughly equivalent to text analytics, refers to the process of deriving high quality information from text.

  2. CIA Chief Tech Officer: Big Data Is The Future And We Own It • CIA's chief technology officer detailed the Agency's vision for collecting and analyzing all of the information people put on the Internet.

  3. intstrcmp ( const char * str1, const char * str2 ); • Compare two strings • Compares the C string str1 to the C string str2.

  4. strcmp- Return Value • A zero value indicates that both strings are equal.

  5. strcmp example char fruit[]=“apple”; char input[80]; gets(input); f(strcmp (fruit,input) == 0){ printf(“Correct Answer!”); }

  6. Passing Parameters to main(intargc, char *argv[]) • C allows parameters to be passed from the operating system to the program when it starts executing • The parameter argcholds the number of parameters passed to the program. • The array argv[ ] holds the addresses of each parameter passed • argv[0] is always the program name

  7. Passing Parameters to main(intargc, char *argv[]) #include <stdio.h> main(intargc, char *argv[]) { int n; for(n = 0; n < argc; n++) printf ("\nParameter %d equals %s",n,argv[n]); system("pause"); return 0; }

  8. The function strtok( ) • For extracting substrings from within a single string. • It is used when the substrings are separated by known delimiters, such as the commas. • Initially, you call strtok( ) with the name of the string variable to be parsed, and a second string that contains the known delimiters. • Strtok( ) then returns a pointer to the start of the first substringand replaces the first token with a zero delimiter

  9. The function strtok( ) • Subsequent calls to strtok( ) can be made in a loop, passing NULL as the string to be parsed; strtok( ) will return the subsequent substrings. • Since strtok() can accept numerous delimiter characters in the second parameter string, you can use it as the basis of a simple word-counting program

  10. strtok( ) Return Value • A pointer to the last token found in string. • A null pointer is returned if there are no tokens left to retrieve.

  11. strtok(buffer,"\t\n,;:.!?()- "); • \t(tab) \n(newline) , ; : . ! ? ( ) - and [space]

  12. The function strtok( ) #include <stdio.h> #include <string.h> main() { char data[50]; char *p; strcpy(data,"RED,ORANGE,YELLOW,GREEN,BLUE,INDIGO,VIOLET"); p = strtok(data,","); while(p!=NULL) { puts(p); p = strtok(NULL,","); } system("pause"); }

  13. Array Of Strings Constants char*wordlist[WordListSize]={"terrorism","bomb","qaeda","terror","attack","iraq","afghanistan","iran","pakistan","islam","osama","muslims","muslim"};

  14. inttolower ( int c ); • Converts c to its lowercase equivalent if c is an uppercase letter and has a lowercase equivalent. • If no such conversion is possible, the value returned is c unchanged.

  15. tolower-Return Value • The lowercase equivalent to c, if such value exists, or c (unchanged) otherwise. • The value is returned as an int value that can be implicitly casted to char.

  16. Convert string to lower case int main(){ char s[]=“HELLO”; toLower(s); system(“pause”); return 0; } void toLower(char s[]){ inti=0; for(i=0;s[i];i++){ s[i]=tolower(s[i]); } }

  17. char * gets ( char * str ); • Get string from stdin • Reads characters from the standard input (stdin) and stores them as a C string into str until a newline character or the end-of-file is reached. • The newline character, if found, is not copied into str.A terminating null character is automaticallyappended after the characters copied to str.

  18. Gets - example #include <stdio.h> intmain() { char string [256]; printf("Insert your full address: "); gets (string); printf("Your address is: %s\n",string); return 0; }

  19. Last Element Of String And Address(Excluding Null) char text[]="Hello World”; Last Element: • text[strlen(text) – 1]; • Address of Last Element: &text[strlen(text) – 1];

  20. The Fox, the Goose, and the Corn • PROBLEM: HOW TO CROSS THE RIVER?

  21. The Fox, the Goose, and the Corn- Solution • The farmer has to take the goose on the first trip. • On the second trip, let’s suppose the farmer takes the fox. • Instead of leaving the fox with the goose, though, the farmer takes the goose back to the near shore. • Then the farmer takes the sack of corn across • leaving the fox and the corn on the far shore. • while returning for a fourth trip with the goose

  22. The key constraints 1. The farmer can take only one item at a time in the boat. 2. The fox and goose cannot be left alone on the same shore. 3. The goose and corn cannot be left alone on the same shore.

  23. Difference ? • char h[]="hello" • is different from • char * h="hello";

  24. A Subscripted Array Reference

  25. A Pointer Reference

  26. Define as Pointer/Reference as Array