Giter Site home page Giter Site logo

Comments (9)

Berkmann18 avatar Berkmann18 commented on May 27, 2024 1

@jakebolam I started playing around with the parse-comment module and compromise, trying to find a way to get the plural forms of the #Contributions included.

from app.

Berkmann18 avatar Berkmann18 commented on May 27, 2024 1

@jakebolam Don't forget to close this 😉.

from app.

Berkmann18 avatar Berkmann18 commented on May 27, 2024

I've looked at parse-comment and here are my thoughts:

1. How about validContributionTypes includes the plural of each item on the list

Possible solution

validContributionTypes.forEach(type => validContributionTypes.push(`${type}s`))

Pros

  1. It's One more line that will handle the valid types but in plural.
  2. Doesn't require more dependencies or numerous code to achieve this.

Cons

  1. It's not including the particular plural cases for: eventOrganizing (e.g.: eventsOrganizing), fundingFinding (e.g.: fundingsFinding), userTesting (e.g.: usersTesting).
  2. It's an additional O(n)/Θ(n) (where n = validContributionTypes.length) which will make the process slower as validContributionTypes grows.

2. Using RegExp

Possible solution

const TYPE_RE = /([a-z]+)([A-Z][a-z]+)/;
validContributionTypes
  .map(type => {
    let part = TYPE_RE.exec(type);
    if (part === null) return [type, `${type}s`]
    let [, start, end] = part;
    return [`${start}${end}`, `${start}s${end}`, `${start}${end}s`, `${start}s${end}s`];
  })
  .reduce((a, b) => a.concat(b), [])

Pros

  1. Native approach.
  2. Handles all singular/plural variations.

Cons

  1. Can be nasty and hard to maintain (especially as validContributionTypes changes).

3. Using what compromise offers

Possible solution

const contributions = doc
+       .forEach(type => contributions.push(type.toPlural()))
        .match('#Contribution')
        .data()
        .map(data => {
            // This removes whitespace, commas etc
            return data.normal
        })

Pros

  1. It utilises more the NLP library that this bot uses.
  2. It's less maintenance for this package when it comes to things like this.
  3. It can account for a wide array of plural forms that would be valid in English

Cons

  1. It might be tricky to get right (especially for people not familiar with compromise).

from app.

jakebolam avatar jakebolam commented on May 27, 2024

@Berkmann18 thanks for looking into this. Really like the break down of options, so great!

I like your 3rd solution (continuing to use compromise). I think there is a learning curve to compromise but I'm hoping that it will allow the bot to expand into better parsing/understanding of user intentions.

I have the vision of the bot being able to recognise terms such as
@AllContributorsBot please add Berkmann18 for documentation, ideas
e.g.

  • doc could be: docs, documentation, documenting etc

Or even completly different wording.
@AllContributorsBot Berkmann18 has been great on the docs, could you add him as a contributor

Add maybe even additional languages

from app.

allcontributors avatar allcontributors commented on May 27, 2024

@jakebolam

I'm not sure how to thanks

Basic usage: @@AllContributorsBot please add jakebolam for code, doc

from app.

jakebolam avatar jakebolam commented on May 27, 2024

^ Need to figure out better ways of it responding to messages, not intended for it too (ticketed some stuff here #14)

from app.

jakebolam avatar jakebolam commented on May 27, 2024

@Berkmann18 did you want to put a PR for this? As you did all the work :)

from app.

Berkmann18 avatar Berkmann18 commented on May 27, 2024

It turns out compromise doesn't handle that sort of thing without having a form of RegExp or array change and I was recommended to have the array with the plural forms in it before the .match(#Contribution) happens.

from app.

jakebolam avatar jakebolam commented on May 27, 2024

Closing. Fixed in #53

from app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.