Skip to content
This repository was archived by the owner on Jan 12, 2021. It is now read-only.
This repository was archived by the owner on Jan 12, 2021. It is now read-only.

Try to predict command #122

@orsinium

Description

@orsinium
  1. If one word passed as a command, but there is no command with this name, it is possible that missed the first word. For example, if called command shell it means venv shell.
  2. If command not found, possibly it's a misspelling. For exapmle, venv shll means venv shell. There is the simplest way to do it:
from collections import Counter

def similar(command1: str, command2: str) -> bool:
  c1 = Counter(command1)
  c2 = Counter(command2)
  c = (c1 - c2) + (c2 - c1)
  diff = sum(c.values())
  return diff < 2

See #119 for context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions