Skip to content

word-count: example implementation doesn't handle words with apostrophes #1045

Closed

Description

@jackattack24

I updated the tests for word-count in PR #1044. However, the following two tests from the canonical data both failed with the example implementation:

    {
      "description": "with apostrophes",
      "property": "countwords",
      "input": "First: don't laugh. Then: don't cry.",
      "expected": {
        "first": 1,
        "don't": 2,
        "laugh": 1,
        "then": 1,
        "cry": 1
      }
    },
    {
      "description": "with quotations",
      "property": "countwords",
      "input": "Joe can't tell between 'large' and large.",
      "expected": {
        "joe": 1,
        "can't": 1,
        "tell": 1,
        "between": 1,
        "large": 2,
        "and": 1
      }
    }

"don't" ended up getting split into "don" and "t" which were counted as seperate words, and the same happened with "can't".

Activity

  1. N-Parsons commented on Oct 26, 2017

    @N-Parsons
    Contributor

    Thanks for raising this, @jackattack24. I've submitted a PR that resolves this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions