How to use compromise - 10 common examples

To help you get started, we’ve selected a few compromise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jddunn / frame / frame / src / lib / node-nlp-service.js View on Github external
export function parseTextForTopics(text) {
    // return(nlp(text).topics().out('topk'));
    return(nlp(text).topics().slice(0, 30).out('frequency'));
}
github all-contributors / all-contributors-bot / src / tasks / processIssueComment / utils / parse-comment / index.js View on Github external
validContributionTypes.forEach(type => {
    Contributions[type] = 'Contribution'
})

Object.keys(contributionTypeMappings).forEach(type => {
    Contributions[`${type}`] = 'Contribution'
})

const plugin = {
    words: {
        ...Contributions,
        add: 'Action',
    },
}

nlp.plugin(plugin)

function parseAddComment(message, action) {
    const whoMatched = nlp(message)
        .match(`${action} [.]`)
        .normalize({
            whitespace: true, // remove hyphens, newlines, and force one space between words
            case: false, // keep only first-word, and 'entity' titlecasing
            numbers: false, // turn 'seven' to '7'
            punctuation: true, // remove commas, semicolons - but keep sentence-ending punctuation
            unicode: false, // visually romanize/anglicize 'Björk' into 'Bjork'.
            contractions: false, // turn "isn't" to "is not"
            acronyms: false, //remove periods from acronyms, like 'F.B.I.'
            parentheses: false, //remove words inside brackets (like these)
            possessives: false, // turn "Google's tax return" to "Google tax return"
            plurals: false, // turn "batmobiles" into "batmobile"
            verbs: false, // turn all verbs into Infinitive form - "I walked" → "I walk"
github jddunn / frame / frame / src / lib / node-nlp-service.js View on Github external
export function normalizeText(text) {
    return (nlp(text).normalize());
}
github nlp-compromise / react-nlp / src / NlpTextArea.jsx View on Github external
shared_text: {
        position: 'absolute',
        top: 0,
        left: 0,
        width: '100%',
        fontFamily: 'Helvetica',
        fontSize: 20,
        padding: '10px 15px 0px 15px',
        margin: 0,
        color: 'grey'
      }
    }
    this.state = {
      text: props.text,
      trailing: '',
      parsed: nlp(props.text)
    }
    this.overlay = this.overlay.bind(this)
    this.onChange = this.onChange.bind(this)
    this.hiddenText = this.hiddenText.bind(this)
  }
github jddunn / frame / frame / src / lib / node-nlp-service.js View on Github external
export function parseTextForDates(text) {
    return(nlp('text').dates().slice(0, 50).out('frequency'));
}
github jddunn / frame / frame / src / lib / node-nlp-service.js View on Github external
export function parseTextForPlaces(text) {
    return(nlp(text).places().slice(0, 50).out('frequency'));
}
github jddunn / frame / frame / src / lib / node-nlp-service.js View on Github external
export function parseTextForTrigrams(text) {
    return(nlp(text).ngrams().trigrams().slice(0, 30).out('frequency'));
}
github nlp-compromise / react-nlp / src / NlpTextArea.jsx View on Github external
onChange() {
    let {state} = this
    let el = this.refs.textarea
    if (el) {
      state.text = el.value
      state.parsed = nlp(state.text)
    }
    state.trailing = state.text.match(/\s+$/) || ''
    this.setState(state)
  }
github jddunn / frame / frame / src / lib / node-nlp-service.js View on Github external
export function parseTextForTerms(text) {
    return(filterCommonWords(nlp(text).terms().slice(0, 30).out('frequency')));
}
github jddunn / frame / frame / src / lib / node-nlp-service.js View on Github external
export function parseTextForBigrams(text) {
    return(nlp(text).ngrams().bigrams().slice(0, 30).out('frequency'));
}

compromise

modest natural language processing

MIT
Latest version published 1 month ago

Package Health Score

86 / 100
Full package analysis

Popular compromise functions