패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.2.0

fuzzywuzzy

모든 퍼지 문자열 매칭/검색 요구 사항을 충족시키기 위한 Dart용 인기 있는 fuzzywuzzy 패키지의 구현입니다!

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
7.2만
좋아요
153
Pub 점수
150

패키지 설치

flutter pub add fuzzywuzzy

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Fuzzywuzzy는 인기 있는 퍼지 문자열 매칭 라이브러리의 Dart 구현으로, 검색, 중복 제거 및 데이터 조정과 같은 작업에 정확하고 유연한 문자열 비교를 가능하게 합니다. Levenshtein 거리와 토큰 기반 방법과 같은 알고리즘을 사용하여 문자열 간의 유사도 점수를 계산하며, 오타, 변형 및 근접 매칭 처리에 이상적입니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 광범위한 호환성을 보장합니다. 가볍고 Flutter pub를 통해 쉽게 통합할 수 있습니다.

사용 사례

  • 오타가 있는 텍스트 검색
  • 데이터 중복 제거
  • 데이터셋 간 이름 일치
  • 허용 오차를 포함한 자동 제안
  • 사용자 입력을 데이터베이스 항목과 일치시키기

주요 기능

  • 레벤슈타인 거리 점수
  • 토큰 정렬 및 세트 비율
  • 대소문자 구분 없는 매칭
  • 크로스 플랫폼 지원
  • 간단한 API 통합

적합한 대상

  • 강력한 문자열 매칭이 필요한 개발자
  • 사용자 생성 텍스트 입력이 있는 앱
  • 데이터 정제 파이프라인
  • 오류 내성 검색 기능

고려 사항

  • 대규모 데이터 세트에서 더 느릴 수 있습니다
  • 실시간 고주파 매칭에 최적화되지 않음
  • 정확도를 위해 신중한 임계값 조정이 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

FuzzyWuzzy

Tests Coverage Status

This is a Dart port of the popular FuzzyWuzzy python package. This algorithm uses Levenshtein distance to calculate similarity between strings.

I personally needed to use this for my own search algorithms, and there weren't any packages as good as my experience with FuzzyWuzzy was, so here we are. Enjoy!

  • Just one dependency (collection).
  • Pure Dart implementation of the superfast python-Levenshtein.
  • Simple to use.
  • Lightweight.
  • Massive props to the folks over at seatgeek for coming up with the algorithm.

Get started

Add dependency
dependencies:
  fuzzywuzzy: <latest version>

Usage

First, import the package

import 'package:fuzzywuzzy/fuzzywuzzy.dart'
Simple ratio
ratio("mysmilarstring", "myawfullysimilarstirng") // 72
ratio("mysmilarstring", "mysimilarstring")        // 97
Partial ratio
partialRatio("similar", "somewhresimlrbetweenthisstring") // 71
Token sort ratio
tokenSortPartialRatio("order words out of", "words out of order") // 100
tokenSortRatio("order words out of","  words out of order")       // 100
Token set ratio
tokenSetRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear")         // 100
tokenSetPartialRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear")  // 100
Weighted ratio
weightedRatio("The quick brown fox jimps ofver the small lazy dog", "the quick brown fox jumps over the small lazy dog") // 97
Extract
extractOne(
        query: 'cowboys',
        choices: [
          'Atlanta Falcons',
          'New York Jets',
          'New York Giants',
          'Dallas Cowboys'
        ],
        cutoff: 10,
      ) // (string Dallas Cowboys, score: 90, index: 3)
extractTop(
        query: 'goolge',
        choices: [
          'google',
          'bing',
          'facebook',
          'linkedin',
          'twitter',
          'googleplus',
          'bingnews',
          'plexoogl'
        ],
        limit: 4,
        cutoff: 50,
      ) // [(string google, score: 83, index: 0), (string googleplus, score: 75, index: 5)]
extractAllSorted(
        query: 'goolge',
        choices: [
          'google',
          'bing',
          'facebook',
          'linkedin',
          'twitter',
          'googleplus',
          'bingnews',
          'plexoogl'
        ],
        cutoff: 10,
      ) // [(string google, score: 83, index: 0), (string googleplus, score: 75, index: 5), (string plexoogl, score: 43, index: 7), (string bingnews, score: 29, index: 6), (string linkedin, score: 29, index: 3), (string facebook, score: 29, index: 2), (string bing, score: 23, index: 1), (string twitter, score: 15, index: 4)]
extractAll(
        query: 'goolge',
        choices: [
          'google',
          'bing',
          'facebook',
          'linkedin',
          'twitter',
          'googleplus',
          'bingnews',
          'plexoogl'
        ],
        cutoff: 10,
      ) // [(string google, score: 83, index: 0), (string bing, score: 23, index: 1), (string facebook, score: 29, index: 2), (string linkedin, score: 29, index: 3), (string twitter, score: 15, index: 4), (string googleplus, score: 75, index: 5), (string bingnews, score: 29, index: 6), (string plexoogl, score: 43, index: 7)]
Extract using any a list of any type

All extract methods can receive List<T> and return List<ExtractedResult<T>>

class TestContainer {
  final String innerVal;
  TestContainer(this.innerVal);
}

extractOne<TestContainer>(
        query: 'cowboys',
        choices: [
          'Atlanta Falcons',
          'New York Jets',
          'New York Giants',
          'Dallas Cowboys'
        ].map((e) => TestContainer(e)).toList(),
        cutoff: 10,
        getter: (x) => x.innerVal
      ).toString(); // (string Dallas Cowboys, score: 90, index: 3)

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트