Discuss Scratch

DJUmbreon2
Scratcher
100+ posts

“is similar to” block

/!\ WARNING, THIS BLOCK HAS NO WORKAROUND AND IS VERY COMPLEX TO MAKE /!\
Now, onto the block
<[] is similar to [] :: operators>
1. How does this work?
Read the Top First

It basically sees if a string is similar to another string

2. Is there a workaround
NO

Last edited by DJUmbreon2 (June 5, 2021 20:39:09)

fdreerf
Scratcher
1000+ posts

“is similar to” block

What does “similar” even mean in the context of this block? It could mean basically anything.
-Accio-
Scratcher
1000+ posts

“is similar to” block

What do you mean by similar? This seems very ambiguous. For example, would it return true for Scratch and Scrathc? What about for 11 and 12? By similar meanings, would happy and glad return true?

Last edited by -Accio- (June 5, 2021 20:44:18)

DJUmbreon2
Scratcher
100+ posts

“is similar to” block

fdreerf wrote:

What does “similar” even mean in the context of this block? It could mean basically anything.

Welp, Here we go

UmbreonFX wrote:

By is similar to, I mean that the two strings have similar meanings or the strings contain similar text

Last edited by DJUmbreon2 (June 5, 2021 20:42:08)

DJUmbreon2
Scratcher
100+ posts

“is similar to” block

-Accio- wrote:

What do you mean by similar? This seems very ambiguous. For example, would it return true for Scratch and Scrathc? What about for 11 and 12?

DJUmbreon2 wrote:

fdreerf wrote:

What does “similar” even mean in the context of this block? It could mean basically anything.

Welp, Here we go

UmbreonFX wrote:

By is similar to, I mean that the two strings have similar meanings or the strings contain similar text
-Accio-
Scratcher
1000+ posts

“is similar to” block

I understand what you mean, but what I am asking is how different would two words have to be in order for it to return false.

Eg.
Scratch and Scrathc
Scratch and Scrahtc
Scratch and hctarcS
Scratch and Sacrthc
Scratch and Scratc
Scratch and ratch
etc.

What would be the requirements for it to return true?
fdreerf
Scratcher
1000+ posts

“is similar to” block

DJUmbreon2 wrote:

fdreerf wrote:

What does “similar” even mean in the context of this block? It could mean basically anything.

Welp, Here we go

UmbreonFX wrote:

By is similar to, I mean that the two strings have similar meanings or the strings contain similar text
What does that exactly mean? A computer can't decide what's similar or not without a rigorous definition.
DJUmbreon2
Scratcher
100+ posts

“is similar to” block

fdreerf wrote:

DJUmbreon2 wrote:

fdreerf wrote:

What does “similar” even mean in the context of this block? It could mean basically anything.

Welp, Here we go

UmbreonFX wrote:

By is similar to, I mean that the two strings have similar meanings or the strings contain similar text
What does that exactly mean? A computer can't decide what's similar or not without a rigorous definition.
Oh god
BearSlothCoding
Scratcher
1000+ posts

“is similar to” block

DJUmbreon2 wrote:

fdreerf wrote:

DJUmbreon2 wrote:

fdreerf wrote:

What does “similar” even mean in the context of this block? It could mean basically anything.

Welp, Here we go

UmbreonFX wrote:

By is similar to, I mean that the two strings have similar meanings or the strings contain similar text
What does that exactly mean? A computer can't decide what's similar or not without a rigorous definition.
Oh god
I mean, you basically just said “By similar, I mean that the two strings are similar”
What do you mean by similar? Similar in terms of what? There are multiple ways that strings could be similar. For example, blew and blue are similar in terms of pronunciation but not spelling, meaning, or part of speech. It's not like there's only one universal way for things to be similar, so which one do you mean?
awesome-llama
Scratcher
1000+ posts

“is similar to” block

The solution to this is to define what similar is exactly, which I can tell from this topic that it could mean how many characters of two strings are the same. Also something else to consider is what is done with letters which are swapped around, e.g. test and tset. I ignored this for this example as it is easier to understand without. But perhaps there is a special weighting to this situation, like it only counts as 1 dissimilar letter or something.

Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

From this, it is possible to make a reporter block version:

(similarity of [test] and [te5t]::operators) // outputs 75 because 75% of characters match.

Last edited by awesome-llama (June 6, 2021 12:12:06)

PGBFLITE6373
Scratcher
1000+ posts

“is similar to” block

awesome-llama wrote:

The solution to this is to define what similar is exactly, which I can tell from this topic that it could mean how many characters of two strings are the same. Also something else to consider is what is done with letters which are swapped around, e.g. test and tset. I ignored this for this example as it is easier to understand without. But perhaps there is a special weighting to this situation, like it only counts as 1 dissimilar letter or something
Support to this if this is what the creator is saying, has i can see it being useful when making a game
DJUmbreon2
Scratcher
100+ posts

“is similar to” block

awesome-llama wrote:

The solution to this is to define what similar is exactly, which I can tell from this topic that it could mean how many characters of two strings are the same. Also something else to consider is what is done with letters which are swapped around, e.g. test and tset. I ignored this for this example as it is easier to understand without. But perhaps there is a special weighting to this situation, like it only counts as 1 dissimilar letter or something.

Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

From this, it is possible to make a reporter block version:

(similarity of [test] and [te5t]::operators) // outputs 75 because 75% of characters match.

Thx, I needed that
DarthVader4Life
Scratcher
1000+ posts

“is similar to” block

awesome-llama wrote:

-snip-
Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

-snip-
For the boolean blocks, I think that it's best if we do this:

<[test] is [more than v] (50)% similar to [te5t] :: operators>

The dropdown would contain “more than”, “less than”, and “equal to”.

Last edited by DarthVader4Life (June 6, 2021 15:19:14)

fdreerf
Scratcher
1000+ posts

“is similar to” block

DarthVader4Life wrote:

awesome-llama wrote:

-snip-
Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

-snip-
For the boolean blocks, I think that it's best if we do this:

<[test] is [more than v] (50)% similar to [te5t] :: operators>

The dropdown would contain “more than”, “less than”, and “equal to”.
The boolean blocks are unnecessary since you can just plug the reporter into the preexisting boolean comparison blocks. Frankly, this procedure isn't used very often and the workaround is a matter of going through all of the letters and see if they match or not.
cruncherBones
Scratcher
500+ posts

“is similar to” block

awesome-llama wrote:

The solution to this is to define what similar is exactly, which I can tell from this topic that it could mean how many characters of two strings are the same. Also something else to consider is what is done with letters which are swapped around, e.g. test and tset. I ignored this for this example as it is easier to understand without. But perhaps there is a special weighting to this situation, like it only counts as 1 dissimilar letter or something.

Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

From this, it is possible to make a reporter block version:

(similarity of [test] and [te5t]::operators) // outputs 75 because 75% of characters match.
How would percent be calculated?
DarthVader4Life
Scratcher
1000+ posts

“is similar to” block

fdreerf wrote:

DarthVader4Life wrote:

-snip-
The boolean blocks are unnecessary since you can just plug the reporter into the preexisting boolean comparison blocks. Frankly, this procedure isn't used very often and the workaround is a matter of going through all of the letters and see if they match or not.
Well, since the workaround is rather long, we should at least have the reporter.
roketH77
Scratcher
1000+ posts

“is similar to” block

I support all the posts above, but it should be a sensing block:
(Similarity of [this] and [that] :: sensing)
DarthVader4Life
Scratcher
1000+ posts

“is similar to” block

cruncherBones wrote:

awesome-llama wrote:

The solution to this is to define what similar is exactly, which I can tell from this topic that it could mean how many characters of two strings are the same. Also something else to consider is what is done with letters which are swapped around, e.g. test and tset. I ignored this for this example as it is easier to understand without. But perhaps there is a special weighting to this situation, like it only counts as 1 dissimilar letter or something.

Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

From this, it is possible to make a reporter block version:

(similarity of [test] and [te5t]::operators) // outputs 75 because 75% of characters match.
How would percent be calculated?
I'm pretty sure it'd be how you would normally calculate a precentage, which is dividing a number by a number, then multiplying by 100 and taking the first 2 numbers that come up. Ex. 10/100 = .1 if you multiply that by 100, you get 10. Therefore, 10 is 10 percent of 100.

For what this block does, it would count each character in the first text input that is in the same place as the same character in the second text input and count each character in the second text input. Then, it would divide the first text input's total number of same characters in the same place as the second text input by the total number of characters in the second text input. After this, it'll multiply by 100 and take the first 2 numbers.

Here's some math to spare you.

Text input 1: ti1
Text input 2: ti2

Text input 1's simularities: 2
Text input 2's character count: 3

2/3 = .666667
.666667 * 100 = 66.6667

66.6667's first two numbers are 66.
The percentage is 66.

Last edited by DarthVader4Life (June 6, 2021 18:53:36)

6d66yh
Scratcher
100+ posts

“is similar to” block

DarthVader4Life wrote:

cruncherBones wrote:

awesome-llama wrote:

The solution to this is to define what similar is exactly, which I can tell from this topic that it could mean how many characters of two strings are the same. Also something else to consider is what is done with letters which are swapped around, e.g. test and tset. I ignored this for this example as it is easier to understand without. But perhaps there is a special weighting to this situation, like it only counts as 1 dissimilar letter or something.

Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

From this, it is possible to make a reporter block version:

(similarity of [test] and [te5t]::operators) // outputs 75 because 75% of characters match.
How would percent be calculated?
I'm pretty sure it'd be how you would normally calculate a precentage, which is dividing a number by a number, then multiplying by 100 and taking the first 2 numbers that come up. Ex. 10/100 = .1 if you multiply that by 100, you get 10. Therefore, 10 is 10 percent of 100.

For what this block does, it would count each character in the first text input that is in the same place as the same character in the second text input and count each character in the second text input. Then, it would divide the first text input's total number of same characters in the same place as the second text input by the total number of characters in the second text input. After this, it'll multiply by 100 and take the first 2 numbers.

Here's some math to spare you.

Text input 1: ti1
Text input 2: ti2

Text input 1's simularities: 2
Text input 2's character count: 3

2/3 = .666667
.666667 * 100 = 66.6667

66.6667's first two numbers are 66.
The percentage is 66.
So the percentage of 1e-9 is 17 (the first two numbers of 1e-7). How does that make any sense?
DarthVader4Life
Scratcher
1000+ posts

“is similar to” block

6d66yh wrote:

DarthVader4Life wrote:

cruncherBones wrote:

awesome-llama wrote:

The solution to this is to define what similar is exactly, which I can tell from this topic that it could mean how many characters of two strings are the same. Also something else to consider is what is done with letters which are swapped around, e.g. test and tset. I ignored this for this example as it is easier to understand without. But perhaps there is a special weighting to this situation, like it only counts as 1 dissimilar letter or something.

Here is a modification to the original to make it work:

<[test] is more than (50)% similar to [te5t]::operators> // true
<[test] is more than (50)% similar to [7e57]::operators> // false

From this, it is possible to make a reporter block version:

(similarity of [test] and [te5t]::operators) // outputs 75 because 75% of characters match.
How would percent be calculated?
I'm pretty sure it'd be how you would normally calculate a precentage, which is dividing a number by a number, then multiplying by 100 and taking the first 2 numbers that come up. Ex. 10/100 = .1 if you multiply that by 100, you get 10. Therefore, 10 is 10 percent of 100.

For what this block does, it would count each character in the first text input that is in the same place as the same character in the second text input and count each character in the second text input. Then, it would divide the first text input's total number of same characters in the same place as the second text input by the total number of characters in the second text input. After this, it'll multiply by 100 and take the first 2 numbers.

Here's some math to spare you.

Text input 1: ti1
Text input 2: ti2

Text input 1's simularities: 2
Text input 2's character count: 3

2/3 = .666667
.666667 * 100 = 66.6667

66.6667's first two numbers are 66.
The percentage is 66.
So the percentage of 1e-9 is 17 (the first two numbers of 1e-7). How does that make any sense?
That's not how percentages work?
You have to divide a number by a number, then multiply by 100, and get the first 2 (3 or more depending on if the first number is equal to or greater than the second number), numbers of that end result.
It has to contain decimals in the end of the division if there is any, by the way.

Last edited by DarthVader4Life (June 6, 2021 20:45:35)

Powered by DjangoBB