exercism / awk

Exercism exercises in AWK.
https://exercism.org/tracks/awk
MIT License
18 stars 21 forks source link

Automated readability index #181

Closed rabestro closed 1 year ago

rabestro commented 1 year ago

As we grow up, we can understand more and more complex texts. But how to assess the level of complexity of a given text, and how to teach the computer to do so? In this exercise, you will write a program determining how difficult a text is and for what age it is best suited.

For a formula for calculating the complexity, we will use Automated readability index (ARI) developed in 1967 year. The ARI assesses the U.S. grade level required to read a piece of text. In some ways, it is similar to other formulas. Its difference is rather than counting syllables, it counts characters. The more characters, the harder the word. It also counts sentences. This sets it apart from some other formulas.

IsaacG commented 1 year ago
rabestro commented 1 year ago
* Is there a reason it's not being added to the problem specs?

Hi Isaac,

Thank you so much for your quick feedback.

It is my first pull request to AWK track, and I assumed I could omit some details in the PR description. For example, I don't know how to generate the file tests.toml and miss it in my PR. I would appreciate it if you could tell me how to format a Pull request properly and how to generate such a file. Did I understand correctly that your last question was related to this file (tests.toml)?

  • What concepts does this exercise teach?
  • What value does it bring to awk?

How should I answer these questions? Could you please give me examples of other problems with the answer to these questions?

My goal was to develop an exciting problem to solve that would be suitable for solving using the AWK language. The task I created may interest the user of the site Exercism. I understand that the task may have some flaws in the current form that I am ready to eliminate with your help.

Best regards, Jegors

glennj commented 1 year ago

I don't know how to generate the file tests.toml and miss it in my PR.

A quick overview of the exercism landscape:

The purpose of all the files in a practice exercise are all documented.

  • What concepts does this exercise teach?
  • What value does it bring to awk?

How should I answer these questions? Could you please give me examples of other problems with the answer to these questions?

My goal was to develop an exciting problem to solve that would be suitable for solving using the AWK language. The task I created may interest the user of the site Exercism. I understand that the task may have some flaws in the current form that I am ready to eliminate with your help.

It is an interesting exercise. It does really cover 2 distinct concepts:

It would be better to focus just on the second concept.

The "contributing guide", HOWTO-port-an-exercise.md, doesn't cover the case of inventing a new exercise.

glennj commented 1 year ago

@IsaacG I would be in favour of adding this exercise here before adding it to problem-specs.

glennj commented 1 year ago

@rabestro I assume, on your local repo, this succeeds:

./bin/validate_one_exercise ./exercises/practice/ari
rabestro commented 1 year ago

@rabestro I assume, on your local repo, this succeeds:

➜  awk git:(ari) ✗ ./bin/validate_one_exercise ./exercises/practice/ari
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
    [-e pattern] [-f file] [--binary-files=value] [--color=when]
    [--context[=num]] [--directories=action] [--label] [--line-buffered]
    [--null] [pattern] [file ...]
➜  awk git:(ari) ✗ 
rabestro commented 1 year ago

@rabestro I assume, on your local repo, this succeeds:

Would you like me to install some specific version of grep? I am using MacOS.

➜  awk git:(ari) ✗ grep --version
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
glennj commented 1 year ago

I use Homebrew on a Mac. Install it then brew install grep to get GNU grep (with the -P option for perl-compatible regular expressions). brew will let you know when you need to adjust your PATH.

rabestro commented 1 year ago
➜  awk git:(ari) ✗ ./bin/validate_one_exercise ./exercises/practice/ari
There should be exactly one commented skip directive in test-ari.bats

➜  awk git:(ari) ✗ ./bin/validate_one_exercise ./exercises/practice/ari
Processing ari
test-ari.bats
 ✓ Exercism is an online, open-source, free coding platform
 ✓ ARI was designed for military use in 1967
 ✓ Billy always listens to his mother

3 tests, 0 failures

Updated 1 path from the index
rabestro commented 1 year ago

Does Exercism properly process math formulas?

Score = 4.71 ( { characters \over words }) + 0.5 ({words \over sentences}) - 21.43
glennj commented 1 year ago

Does Exercism properly process math formulas?

Don't know. That's a question for the forum.

IsaacG commented 1 year ago

How should I answer these questions? Could you please give me examples of other problems with the answer to these questions?

My goal was to develop an exciting problem to solve that would be suitable for solving using the AWK language. The task I created may interest the user of the site Exercism. I understand that the task may have some flaws in the current form that I am ready to eliminate with your help.

Generally a problem should center around some sort of goal or "area" that it teaches/requires, eg parsing inputs, formatting outputs, performing graph traversal, etc. It is helpful to highlight what this exercise "teaches".

Glenn called out that this covers "formatting output" and "calculating a value and looking it up in a map".

It might be worth figuring out if we can tag those in the config.json

@IsaacG I would be in favour of adding this exercise here before adding it to problem-specs.

Sounds good.


In line with all the other exercises, I think this exercise's name should not be abbreviated. ari isn't descriptive and all the other exercise names are.

IsaacG commented 1 year ago

@rabestro Can you fix the exercise name to not be abbreviated? It might be easier to do the rename separate from going over the language.

rabestro commented 1 year ago

@rabestro Can you fix the exercise name to not be abbreviated? It might be easier to do the rename separate from going over the language.

➜  awk git:(ari) ✗ ./bin/validate_one_exercise ./exercises/practice/automated-readability-index 
Processing automated-readability-index
test-automated-readability-index.bats
 ✓ Exercism is an online, open-source, free coding platform
 ✓ ARI was designed for military use in 1967
 ✓ Billy always listens to his mother

3 tests, 0 failures

Updated 1 path from the index
➜  awk git:(ari) ✗ 
rabestro commented 1 year ago

Sorry for lengthy delay in reviewing. I just have a few suggestions for the instructions.

I see. More than 1 million students registered on the site. Of course, I really want to see my problem published as soon as possible. But at the same time, I want there to be no flaws.

glennj commented 1 year ago

To resolve the CI failure, you'll need to add the new exercise into config.json. Be sure to use the bin/configlet tool to generate a new UUID.

glennj commented 1 year ago

Awesome work @rabestro! Thanks for sticking with all those requests for change.

glennj commented 1 year ago

https://exercism.org/tracks/awk/exercises/automated-readability-index

rabestro commented 1 year ago

https://exercism.org/tracks/awk/exercises/automated-readability-index

The very first community solution is there.