Permalink
Browse files

Arreglo de bug al ajustar las proporciones en las funciones de .c

  • Loading branch information...
1 parent 1007920 commit c91e37f67a56e9b87dea804b4b9b05d8975e30ec Manuel Aude Morales committed Oct 26, 2011
View
2 Gemfile.lock
@@ -34,7 +34,6 @@ GEM
erubis (2.6.6)
abstract (>= 1.0.0)
i18n (0.5.0)
- json (1.6.1)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
@@ -75,7 +74,6 @@ PLATFORMS
DEPENDENCIES
bcrypt-ruby
- json
mysql2 (< 0.3)
railroady
rails (= 3.0.7)
View
2 algorithm_app/clib/algorithms.c
@@ -309,7 +309,7 @@ int ld_compare(char *s, char *t)
{
int mini, size1 = strlen(s), size2 = strlen(t);
float res;
- mini = min(size1, size2);
+ mini = max(size1, size2);
res = 1 - (
((float)levenshtein_distance(s, t, size1, size2))
/ (float) mini);
View
BIN algorithm_app/clib/algorithms.o
Binary file not shown.
View
BIN algorithm_app/clib/libalgorithms.so
Binary file not shown.
View
5 algorithm_app/varch_algorithms/webservice/views.py
@@ -28,7 +28,8 @@ def compare(request):
files = req['files']
for f in files:
#get rid off spaces and make it a c-valid parameter
- f['code'] = ctypes.c_char_p('lala')
+ f['code'] = ctypes.c_char_p(f['code'])
+
#n corridas, cada corrida tomamos el dato a mandar y creamos un arreglo sin el
if len(files) < 2:
@@ -42,8 +43,10 @@ def compare(request):
for tc in to_compare:
curr_similarity = {'id' : tc['id'], 'similarity' : {}}
if '1' in req['algorithms']:
+ print curr_file['code'], tc['code'], algorithms.ld_compare(curr_file['code'], tc['code'])
curr_similarity['similarity']['1'] = algorithms.ld_compare(curr_file['code'], tc['code'])
if '2' in req['algorithms']:
+ print curr_file['code'], tc['code'], algorithms.sherlock_compare(curr_file['code'], tc['code'])
curr_similarity['similarity']['2'] = algorithms.sherlock_compare(curr_file['code'], tc['code'])
similarities.append(curr_similarity)
result.append({'id' : curr_file['id'], 'similarities' : similarities})
View
BIN algorithm_app/varch_algorithms/webservice/views.pyc
Binary file not shown.

0 comments on commit c91e37f

Please sign in to comment.