7 kyu
Compress sentences
787 of 1,272mikeos
Loading description...
Lists
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
The issue here is that Acceptance Criteria provide the wording as
If a word appears more than once in the sentence, your string should return the position of the first occurrence of the word.
so you tend to reference the original sentence.Meanwhile tests and solutions show, that the "correct" approach is to treat and refer to the 1st occurance in condensed (no repetitions) array of words, which, coincidently, is expected to have the inherited order of the initial sentense.
either you said the same thing as the wording or i have no clue what you just said
please simplify what you just said, i cant comprehend it :(
Hey man! Sorry. Here's the example of what I mean: The test phrase
The number 0 is such a strange number Strangely it has zero meaning
This happens due to the discrepancy of implementation and acceptance criteria:
In AC we're suggested to add an index of an original sentence (as I read it)
In acceptable solution to pass tests we:
a. condense the sentense to unique
set
of strings; b. return indexes of thoseWhich, in turn eliminates the repetition of the word "number" from the sentense making the index of "Strangely" = 7
P.S. I am referring to a last assertion in "Basic tests" for the excersise.
Ah ye, this kata was updated by someone else ill fix it when im home i promise
"The unique position is the position of every different word in the sentence, which excludes repeated words"
i was going to add this, do you reckon that's a good explanation? give suggestions if you have a better idea
i want to keep it short and concise whilst not being too complex to understand
ok i have changed it again hopefully its a bit clearer this time
Yeah, this helps. Thank you very much!
python new test framework is required. updated in this fork
Approved
thank you
Question is too vague
Not a valid suggestion
i changed it to be less vague
"Your task is to make a program which takes in a sentence and returns a string which shows the position of each word in the sentence. If a word appears more than once in the sentence, your string should return the position of the first occurrence of the word. Capitalisation of words should be accounted for: 'BEE' should be considered the same as 'bee'. The sentences include no punctuation."
This comment has been hidden.
This is not a question, and please don't spoil solutions. Users are not supposed to solve the katas by reading the Discourse page.
The task is not clear. And my comment doesn't spoil the solution, but clears the request.
i changed it to be less value. is this better
"Your task is to make a program which takes in a sentence and returns a string which shows the position of each word in the sentence. If a word appears more than once in the sentence, your string should return the position of the first occurrence of the word. Capitalisation of words should be accounted for: 'BEE' should be considered the same as 'bee'. The sentences include no punctuation."
This comment has been hidden.
This comment has been hidden.
COBOL translation (author is inactive).
Is there anyway to let you add this? Im computerless atm
What do you mean? Add what? If you cannot approve yourself but you're right with the translation we can ask a moderator to approve it.
Yeah I'm happy just can't figure how to accept your translation on mobile
No problem, we'll ask a moderator, thanks!
.
This should be a 6kyu not a 7kyu
ranks cant be changed
For test "counter pop counter counter stars" "01002"
This comment has been hidden.
It's possible. The last basic test says it all ~~
Great kata. Learned something new. JavaScript translation kumited!
Approved
Thanks
Really cool introduction to compression. Thank you!
for the following test case, my code is failing to pass: "The number 0 is such a strange number Strangely it has zero meaning"
Not able to understand why?. Should 0 to be considered punctuaion and be ignored/removed. I have removed 0 from the sentence made a new sentence (convered all to lower case, removed space in place of 0) "the number is such a strange number strangely it has zero meaning"
The result is as shown below. Where am I doing worng. Did I understand the kata correctly?.
'01234517891011' should equal '012345617891011'
0 should not be counted as puncuation and should be counted as any other word
Approved!
Thank you
Your random test cases are a little broken... You're just comparing the results of compress to itself, which is kind of bad.
and it needs more random tests too!
BTW, using
Test.describe("Rndom tests")
would be a good idea too, so that the warrior knows what's going onThanks Fixed random tests and added a few more Added describe too
you could be a bit greedier... Why not 50 random tests? ;)
I'll think about it tomorrow to be honest, lol.