Showing posts with label string compare. Show all posts
Showing posts with label string compare. Show all posts

8/20/2019

compare text using fuzzy wuzzy in python

just refer to this example..it's simple and very useful.

#pip install fuzzywuzzy
from fuzzywuzzy import process
candidate = ["Atlanta Falcons", "New York Jetss", "New York Giants", "Dallas Cowboys"]
search = "new york jets"
r1 = process.extract(search, candidate)
#r1 = process.extract(search, candidate, limit=3)
search = "cowboys"
r2 = process.extractOne(search, candidate)
search = "new york jets"
r3 = process.extractBests(search, candidate, score_cutoff=70)
print(r1)
#[('New York Jetss', 96), ('New York Giants', 79), ('Atlanta Falcons', 29), ('Dallas Cowboys', 22)]
print(r2)
#('Dallas Cowboys', 90)
print(r3)
#[('Dallas Cowboys', 90)]


3/06/2014

(C, C++) char * compare, strcmp function


#include < stdio.h>
#include < string.h>

int main ()
{
  char szKey[] = "apple";
  if( strcmp (szKey,"apple") == 0)
       printf("same\n");
  else
       printf("different\n");

  
  return 0;
}