Comments (9)
@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.
@jakebolam Don't forget to close this 😉.
from app.
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
- It's One more line that will handle the valid types but in plural.
- Doesn't require more dependencies or numerous code to achieve this.
Cons
- It's not including the particular plural cases for:
eventOrganizing
(e.g.:eventsOrganizing
),fundingFinding
(e.g.:fundingsFinding
),userTesting
(e.g.:usersTesting
). - 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
- Native approach.
- Handles all singular/plural variations.
Cons
- 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
- It utilises more the NLP library that this bot uses.
- It's less maintenance for this package when it comes to things like this.
- It can account for a wide array of plural forms that would be valid in English
Cons
- It might be tricky to get right (especially for people not familiar with
compromise
).
from app.
@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.
I'm not sure how to thanks
Basic usage: @@AllContributorsBot please add jakebolam for code, doc
from app.
^ Need to figure out better ways of it responding to messages, not intended for it too (ticketed some stuff here #14)
from app.
@Berkmann18 did you want to put a PR for this? As you did all the work :)
from app.
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.
Closing. Fixed in #53
from app.
Related Issues (20)
- Readme card not updating HOT 1
- We had trouble processing your request. Please try again later. HOT 1
- Gitea support HOT 1
- Is there a way to remove contributors from a project? HOT 2
- Bot errors if repo already has `all-contributors` branch HOT 2
- Bot both creates a PR and complains about no contributions when extra text in comment HOT 1
- Bot cannot deal with username "gu-does-git"
- Discord bot?
- All-contributors bot HOT 2
- Adding contributions through the bot when existing contributions do not validate lead to "trouble processing request" HOT 1
- Adding a contribution replaces some existing data, in specific case?
- Provide an opt-out mechanism to prevent a user from being added to any repo in the future
- Visibility into what CLI / underlying library version the app is using?
- Review
- Add to contributors in the current PR
- Auto-add contributors based on configuration
- Feature request: Bot solves merge conflicts via `rebase` or `merge`
- Improve bot error messaging on invalid commitType config (Example inside) HOT 5
- "wE hAd TrOuBlE pRoCeSsInG yOuR rEqUeSt. PlEaSe TrY aGaIn LaTeR." HOT 3
- The all-contributors bot only partially recognizes the contribution types "infra" and "doc" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from app.