Questions tagged [similarities]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
28 views

cs50 Similarities, the relationship between compare and helpers.py

I write a helpers.py as following. ok to compare to files with lines. but i don't know how to link it with compare.py. I know the staff said no need to open the file, the compare did it. But how do i ...
0
votes
1answer
22 views

pset7 similarities - 404 error

I have submitted pset7 Similarities and it received full marks, but when I try testing it by running the server and uploading files, form submission throws a 404 error. What am I missing? (Side note: ...
0
votes
1answer
861 views

pset7 lines function returns “TypeError: decoding to str: need a bytes-like object, list found”

So I'm currently working in similarities and after making index.html to be able to see which functions work, I started working in lines. When passing in this function with the compare1 (1).c and ...
0
votes
1answer
96 views

PSET 7 similarities substrings function seems ok but dont pass test

I make a substrings function, it seems to work for me, but i cant pass check. :( handles one substring in common Expected 1 matches, not 0 :( handles multiple substrings in common Expected 4 ...
0
votes
1answer
20 views

pset 6 similarities more '<' not supported between instances of 'str' and 'int' error while compiling in helpers.py distances

heres my code from operator import itemgetter class Operation(Enum): """Operations""" DELETED = 1 INSERTED = 2 SUBSTITUTED = 3 def __str__(self): return str(self.name....
0
votes
1answer
95 views

pset7 similarities throws a 400 error when submiting

I'm in my pset7, similarities. Python part of compare works without any issues. But when i check web page with flask, when i click submit, it shows a 400 error. I could not find where the error is. ...
0
votes
1answer
136 views

Where am I going wrong in Similarities: Substrings?

I am currently working on PSet7: Similarities. I have completed all the tests so far except substrings and I was wondering if any of you could tell me where I am going wrong. I am currently failing ...
0
votes
1answer
95 views

cs50 Similarities PSET6

This is my first ever question so apologies if there are any errors in how this has been asked, welcome any criticism. I am having an issue with my function SplitSub in the substring part of the pset....
0
votes
1answer
88 views

PSET 6 [Similarities - less] How is the compare file accessed in this problem since it is not imported to application.py

(Dont be intimidated by length of code chunks, I included all of my guess as to what's going on, so most of it is just stuff to skim over) The folder similarities contains static and template folders ...
0
votes
1answer
220 views

PSET7 - Similarities - Won't Pass Substring Tests?

I'm almost there with Similarities but I just can't seem to get past the last few substring tests. I am passing all tests except the last four: :( handles multiple substrings in common, Expected 4 ...
1
vote
2answers
91 views

Pset6 Similaritites Less Comfortable

Earlier, I was looking up questions about Pset6 to see if there are any answers that can help me with my code, however, it looks like I completely missed the memo for using set with similarities. My ...
1
vote
2answers
43 views

What is length in matrix.html?

I was going through this solution of pset6 (more comfortable) and I fail to understand the following for loop: {% for i in range((s2)|length + 1) %} <th>{{i}}</th> {% endfor %}...
1
vote
1answer
266 views

One fail for check50 on pset6 similarities --less

All of my code passes check50 except for the last one. I come up with 5 matches and not 4 (ba, ar, rb, ba, az). :) helpers.py exists :) helpers.py compiles :) detects no lines in common :) detects ...
1
vote
1answer
94 views

pset 6 - similarities, check50 error

Getting an error on Check50 for Similarities, Pset6. When I run Check50 the log file states: :( helpers.py compiles No module named 'numpy' I'm using the numpy package for setting up the 2D matrix. ...
0
votes
1answer
5k views

TypeError: '<' not supported between instances of 'int' and 'tuple'

I got this first error[image 1] when I tried to sum +1 to a tuple, not realizing it wasnt an int, but when I try to fix it[image 2] for some reason minimum = minimum[0] bugs the previous line of code. ...
1
vote
1answer
107 views

pset6 (Similarities, more)

Does anyone know what this lines of code stand for ? _, operation = matrix[i][j] Specifically I am interested in a dash before the comma. Thank you in advance.
1
vote
0answers
158 views

PSET6: Similarities: More: General Advice

Just looking for some general advice for pset6 similarities more. I went for more (rather than less) as I have had some experience with python and dynamic programming prior to CS50. However I have ...
0
votes
2answers
51 views

Can you help with my thinking in resolving this problem for similarities?

I believe in the video walkthrough, the guy said that it is possible to tell the next steps just from the numbers. However, I can think of several examples of why I don't think this can be so. Take ...
1
vote
1answer
218 views

PSET6 Similarities (more) Could Not Read File1

I am working on the distance function in pset6 similarities (more comfortable). When I run ./score cat ate, it gives me the error "could not read cat". I copied my code to another tab to test out my ...
1
vote
2answers
268 views

Pset6 similarities less substrings I get wrong output

I’m super close. But I cannot figure out right formula. It doesn’t count amount of the similar substrings correctly. I mean the output is wrong. https://pastebin.com/gEvxAS1X
1
vote
1answer
354 views

PSET6 Similarities substrings almost done

def substrings(a, b, n): """Return substrings of length n in both a and b""" global seta global setb x = [] y = [] for i in range(len(a) - n + 1): x.append(a[i:i+n]) ...
1
vote
1answer
228 views

PSET6 Similarities HELP!

I am almost done with similarities I think. Can't really figure out what is wrong with my substrings def substrings(a, b, n): """Return substrings of length n in both a and b""" x = [] y =...
1
vote
0answers
358 views

I don't understand the meta tag “shrink-to-fit=no”

I read so much about this tag, but I'm a little confuse still. This is one of the post and here is another when I read about the subject. What I understand is that the pages were written first with ...
1
vote
1answer
50 views

PSET 6 Similarities no display from log

I am working on the PSET6 more. My code passes the check50, and it displays the comparing table in the website. However, nothing is showing up for the log operations. I have around for answers but I ...
0
votes
1answer
105 views

PSET6 - Similarities - syntax error?

Not sure why, but I'm getting a syntax error when trying to execute my code: "def sentences(a, b):SyntaxError: invalid syntax" from nltk.tokenize import sent_tokenize def lines(a, b): """...
0
votes
1answer
67 views

Should my distances function return the matrix in PSET6?

I'm working on the 'more comfortable' version of Similarities in PSET6. When I execute ./score wordone wordtwo, the IDE responds: 'Could not read wordone'. I initially thought the issue was my web ...
0
votes
1answer
46 views

Unexpected behavior when dealing with edit distances

One more doubt has arised, as I get closer to the end of this course. Doing the less complicated version of Similarities was trivial to me; however, I am going through some issues with the outcomes of ...
0
votes
1answer
27 views

pset6 similarities: log.html does not log operations correctly

The specs for this problem say that log.html has been implemented for us and that we don't need to make any changes for it to work properly, but mine only lists substitutions (jpg below) My matrix ...
0
votes
1answer
143 views

similarities (less) invalid algorithm

My three algo's pass check50 and tests when running directly, but when uploading files / choosing the algorithm, I either get: 1) 400: The browser (or proxy) sent a request that this server could not ...
0
votes
1answer
101 views

PSET6: Similarities More — everything works but the web step-by-step log

I'm working on PSET6 (Similarities More). It passes check50 and runs perfectly on the command line. I was also able to create matrix.html so it displays the matrix correctly (see below). But for some ...
0
votes
1answer
164 views

Similarities (more) helpers.py line 12

def __str__(self): return str(self.name.lower()) I just opened the assignment and I'm seeing an error in the ide that says Method 'name' has no 'lower' member. Can I ignore this or are we ...
0
votes
1answer
71 views

can someone please tell me whats wrong with my code ? on clicking the compare button on my website , its showing me some error

from nltk.tokenize import sent_tokenize def lines(a, b): s = set() a1 = set(a.split('\n')) b1 = set(b.split("\n")) for i in a1: if i in b1: s.add(i) return [...
0
votes
1answer
171 views

Similarities (more) Internal server error

I get a 500 Internal server error whenever I press the score button to go to 'score.html'. My helper.py code works fine. I think the problem is with my Matrix.html page. Please help. Helpers.py: ...
0
votes
1answer
133 views

pset6 (similarities, more, distance - walkthrough) : what's happening at 7:43 in the video?

To transform string 'ca' to 'a', I don't understand why the answer is '1, S' (1, substitution) instead of '1, D' (1, deletion). Since 'a' == 'a', then shouldn't we use the diagonal cell, which is '1, ...
0
votes
1answer
271 views

PSET6 Similarities (More) 500 Internal Server Error

While performing testing of my web application, upon submitting the form and going to /score, none of the actual webpage is displayed, only the text: Internal Server Error The server encountered an ...
0
votes
1answer
102 views

Why are my test files giving out weird results on both my program and cs50's staff solution?

I'd like to know why my test files for pset6 do not get highlighted for the lines that are the same. The official test files work though. What is happening inside my test files? This is the test on ...
0
votes
2answers
195 views

Similarities (More) sometimes fails but works in most cases

For some reason, for some combinations of strings, I receive an IndexError on the compilation of Operations in application.py. However, for most cases, the table renders properly, and in every case, ...
0
votes
1answer
362 views

Pset 6 - Webserver returns 400 Bad Request

My code passes check50 fine. But when I attempt to run my webserver, I keep getting a 400 error whenever I try to "submit" Here's my .html file. I can't imagine that this is the problem as I tried ...
0
votes
1answer
426 views

Pset 6 - Similarities (Less) Problem with substring count

My code is as follows def substrings(a, b, n): """Return substrings of length n in both a and b""" similar = [] lista = [] listb = [] crawla = 0 crawlb = 0 while (crawla + ...
0
votes
1answer
129 views

pset6 similarities How do I fill the rest of cells in edit distance algorithm?

I have the base cases but I don't know how to access them and compute to choose the better operation and save a tuple in the cells from enum import Enum class Operation(Enum): """Operations""" ...
1
vote
2answers
485 views

Help understanding similarities pset6

I still don't get it yet how the 2D list/array works to figure out the cost between the strings (Is the tuple in matrix[len(a)][len(b)] right ? I would like some explanation please kk I have ...
0
votes
1answer
185 views

pset6 similarites more distances wrong operations

Problem I am experiencing: I have figured out an algorithm for distances to calculate the edit distance between two strings. The costs in the tuples are correct, but the conditions are not properly ...
0
votes
1answer
322 views

PSET 6 Similarities More code passes check50 but doesn't work on the web?

My code works perfectly when I run it through check50, and if I compare the strings using "./score FILE1 FILE2" with the words "cat" and "ate" the number of operations returned is 2 - which is correct....
0
votes
2answers
142 views

pset6/similarities more: what is the purpose of enumeration in the Operation class?

Currently tackling pset6 similarities more, and I'm trying to figure out what the purpose of enumeration is for in the Operation class. Here is the code taken from the helpers.py file: class ...
0
votes
1answer
110 views

pset6/similarities more: if edit distance algorithm returns more than 1 cost with same value, which operation takes priority?

I'm working on pset6 similarities (more) and have a question about the edit distance algorithm. If the edit distance algorithm returns more than one cost with the same value, which operation takes ...
1
vote
1answer
235 views

Help understanding edit distance for pset6 similarities

I get the basic gist of edit distance, but there's a part in one of the walkthrough videos for pset6/similarities which I don't understand. https://www.youtube.com/watch?list=PLhQjrBD2T381-...
0
votes
1answer
325 views

PSET6 Similarities Web Form Errors “Cannot POST /compare” and no CSS

I was able to get compare to work properly via the terminal though the web application keeps throwing "Cannot POST /compare" and index.html doesn't show any CSS. The page shows the layout info but no ...
0
votes
1answer
537 views

pset6 similarities substrings fails check50 in 3 cases, but not sure what's wrong with logic

My code isn't efficient, but it's not convoluted which is rare for me. I wrote a helper function, 'slicer', which iterates over the length of a and slices a into length n substrings. 'Substrings' ...
0
votes
1answer
146 views

tried to import windowed from more_itertools (for pset6 similarities less), but module not found

I stumbled on windowing in the more_itertools library which appealed to me as an interesting alternative approach to the substrings functions if I could get it to work: Windowing More Itertools I ...
0
votes
1answer
96 views

pset6 walkthrough cost matrix

In the second walkthrough video Brian uses two example words, "cat" and "ate" to demonstrate cost indexing of a tuple that lists the number of conversion steps and the last type of conversion made. ...