Azure / aml-deploy

GitHub Action that allows you to deploy machine learning models in Azure Machine Learning.
MIT License
41 stars 18 forks source link

Single word functions valid? #51

Closed Mochahintwain closed 3 years ago

Mochahintwain commented 3 years ago

Hi @marvinbuss , I noticed there are functions with single words ergo only one pattern. Will the model detect sentences with the words or does the function only work when there are sentences with one word. I inserted a function for you to check.

` def _positive_word08( self, rule_id="R0079", description="The word ""But"" implies a conflict. It will subconsciously affect your recipient. To make sure you keep it positive use a stronger, more confident word if possible. ", info="Try to be very precise on what you want and use the present form if possible.", example_pos="And", example_neg="But" ) -> None: """ Check for negative and positive tone.

    rule_id (str): The ID of the rule.
    description (str): The description of the rule.
    info (str): Additional info about the rule.
    example_pos (str): Positive example for this rule.
    example_neg (str): Negative example for this rule.
    """
    # Define matcher
    matcher = Matcher(self.nlp.vocab)

    # Define patterns to match
    pattern1 = [
        {"LOWER": "But"}
    ]

    # Add the patterns to the matcher and apply the matcher to the doc
    matcher.add("positivetone_pattern", [pattern1])
    matches = matcher(self.doc)

    # Merge the matched intervals
    intervals = [(start, end) for match_id, start, end in matches]
    merged = merge_intervals(intervals)

    # Add recommendations
    if len(merged) > 0:
        self._add_recommendation(
            rule_id=rule_id,
            description=description,
            info=info,
            example_pos=example_pos,
            example_neg=example_neg,
            token_intervals=merged
        )` @
marvinbuss commented 3 years ago

@Mochahintwain can you please add this issue to the right repository? You have added this to an Azure repository.

This pattern will not work, since "But" is not lowercase. You have to match on "but". If you only want to match this on the start of a sentence, then you have to add this to the pattern.

If you make these changes, the pattern will detect the word.

Mochahintwain commented 3 years ago

Thanks for noticing....I looked up how to change the repository but can't find it...only found it for project boards but we don't have a board. How does that work?

To match any sentence with the word but I have to write:

pattern1 = [
    {"LOWER": "but"}, {"IS_SENT_START": False, "OP": "*"},
]

Is that correct?

Example: We wanted to talk last week but it got canceled