best_effort_parser 0.2.8

  • Readme
  • Changelog
  • Installing
  • 47

best_effort_parser #

Author: Jack Warren

Build Status Coverage Status

Provides assistance with parsing arbitrary, unstructured user input into output types of your choice.

Name Parsing #

best_effort_parser/name.dart

Provides parsing of names by categorizing different parts:

  • family: A person's last name(s)
  • given: A person's first and middle name(s)
  • dropping particle: particle(s) before the person's last name that are ignored if only the last name is shown
  • non-dropping particle: particles(s) before the person's last name that are not ignored if only the last name is shown
  • suffix: abbreviations after a person's last name

Features handling of a wide range of formats: beyond just "<first> <last>" and "<last>, <first>", particles and suffixes are parsed from any reasonably correct position a user may place them.

Example: #

name_example.dart

import 'package:best_effort_parser/name.dart';

void main(List<String> arguments) {
  print(NameParser.basic().parse(arguments.join(' ')).diagnosticString());
}

Demo:

λ  dart .\name_example.dart 'Jack Warren'
[Given]: Jack [Family]: Warren

λ  dart .\name_example.dart 'La Fontaine, Jean de'
[Given]: Jean [Dropping Particle]: de [Non-dropping Particle]: La [Family]: Fontaine

λ  dart .\name_example.dart 'Gates, Bill III'
[Given]: Bill [Family]: Gates [Suffix]: III

λ  dart .\name_example.dart 'Willem de Kooning'
[Given]: Willem [Dropping Particle]: de [Family]: Kooning

Customization of both parsing and output type is available.

Feature requests and bugs #

Please file feature requests and bugs at the issue tracker.

0.2.8 #

  • Make the deployment script executable

0.2.7 #

  • Manual Travis deployment because "deploy:" doesn't appear to work

0.2.6 #

  • Skip cleanup

0.2.5 #

  • Yet more Travis fixes

0.2.4 #

  • More Travis fixes

0.2.3 #

  • Configure deployment script deploy.sh

0.2.2 #

  • Configure Travis and Coveralls

0.2.1 #

  • Updated README.md
  • Name parsing example (name_example.dart)

0.2.0 #

  • Name parsing with documentation, testing, and diagnostics

0.1.0 #

  • Name parsing functional
    • TODO: better documentation, testing, diagnostics

0.0.1 #

  • Add project configuration files
  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  best_effort_parser: ^0.2.8

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:best_effort_parser/name.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
91
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

We analyzed this package on Jun 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1

Health suggestions

Fix lib/name.dart. (-5.36 points)

Analysis of lib/name.dart reported 11 hints, including:

line 122 col 7: DO use curly braces for all flow control structures.

line 132 col 7: DO use curly braces for all flow control structures.

line 133 col 9: DO use curly braces for all flow control structures.

line 135 col 9: DO use curly braces for all flow control structures.

line 151 col 11: DO use curly braces for all flow control structures.

Format lib/src/name/parsed_name.dart.

Run dartfmt to format lib/src/name/parsed_name.dart.

Maintenance issues and suggestions

Fix analysis_options.yaml.

The analyzer can't parse analysis_options.yaml.

Package is getting outdated. (-8.77 points)

The package was last published 56 weeks ago.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and best_effort_parser.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0
test_coverage ^0.2.0