Skip to main content

Questions tagged [similarities]

Filter by
Sorted by
Tagged with
0 votes
1 answer
66 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 ...
user21342's user avatar
0 votes
1 answer
37 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: ...
pidgetwitter's user avatar
0 votes
1 answer
3k 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 ...
Omi11's user avatar
  • 9
0 votes
1 answer
109 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 ...
Tory's user avatar
  • 1
0 votes
1 answer
56 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....
Amber's user avatar
  • 9
0 votes
1 answer
156 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. ...
Parthiban Bala's user avatar
0 votes
1 answer
145 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 ...
Jacob Pieczynski's user avatar
0 votes
1 answer
116 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....
francis's user avatar
0 votes
1 answer
148 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 ...
AutodidAce's user avatar
0 votes
1 answer
239 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 ...
snejame's user avatar
  • 105
1 vote
2 answers
104 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 ...
Tenacity's user avatar
  • 157
1 vote
2 answers
44 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 %}...
jainilvachhani's user avatar
1 vote
1 answer
283 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 ...
Rjspareiii's user avatar
1 vote
1 answer
104 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. ...
JJuice's user avatar
  • 119
0 votes
1 answer
10k 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. ...
koi's user avatar
  • 3
1 vote
1 answer
112 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.
Sergey Chernayev's user avatar
1 vote
0 answers
171 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 ...
Iain MacCormick's user avatar
0 votes
2 answers
54 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 ...
user1833028's user avatar
1 vote
1 answer
220 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 ...
Stella. H's user avatar
1 vote
2 answers
292 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
IrinaPenzina's user avatar
1 vote
1 answer
380 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]) ...
sksch1663's user avatar
1 vote
1 answer
236 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 =...
sksch1663's user avatar
2 votes
0 answers
579 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 ...
Frank Agraz's user avatar
1 vote
1 answer
56 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 ...
Esther's user avatar
  • 11
0 votes
1 answer
113 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): """...
Joe Joe Joe's user avatar
0 votes
1 answer
69 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 ...
Krishaan Khubchand's user avatar
0 votes
1 answer
51 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 ...
Igor Matheus Moreira's user avatar
0 votes
1 answer
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 ...
Scott J.'s user avatar
0 votes
1 answer
149 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 ...
Jake 's user avatar
  • 37
0 votes
1 answer
104 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 ...
PXSOCS's user avatar
  • 7
0 votes
1 answer
169 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 ...
Allan Clayton's user avatar
0 votes
1 answer
76 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 [...
user21692's user avatar
0 votes
1 answer
180 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: ...
ARJUN AGGARWAL's user avatar
0 votes
1 answer
138 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, ...
Malintzin's user avatar
0 votes
1 answer
285 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 ...
user9474943's user avatar
0 votes
1 answer
108 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 ...
Pies_R_Square's user avatar
0 votes
2 answers
201 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, ...
wlh's user avatar
  • 132
0 votes
1 answer
556 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 ...
user avatar
0 votes
1 answer
451 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 + ...
user avatar
0 votes
1 answer
136 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""" ...
Rafael Áquila's user avatar
1 vote
2 answers
491 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 ...
Rafael Áquila's user avatar
0 votes
1 answer
195 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 ...
whackdev's user avatar
0 votes
1 answer
328 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....
Elliot's user avatar
  • 3
0 votes
2 answers
145 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 ...
doctopus's user avatar
  • 119
0 votes
1 answer
113 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 ...
doctopus's user avatar
  • 119
1 vote
1 answer
238 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-...
doctopus's user avatar
  • 119
0 votes
1 answer
344 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 ...
ndjustin20's user avatar
0 votes
1 answer
551 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' ...
Lindsey's user avatar
  • 25
0 votes
1 answer
229 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 ...
Lindsey's user avatar
  • 25
0 votes
1 answer
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. ...
Scott J.'s user avatar