Git Product home page Git Product logo

dx1's Introduction

DX1

For better-looking documentation, run haddock -h DX1.hs.

Format

Every line of a .dx1 file contains a word, its number of occurrences (in the corpus it originates from), and its pronunciation (as a sequence of phonemes). Typically, this data is encoded in the form of a space-separated string. For example:

 A 23310 AH0
 AARON 8 EH1 R AH0 N
 ABANDON 18 AH0 B AE1 N D AH0 N
 ABANDONED 26 AH0 B AE1 N D AH0 N D

In the interest of robustness, this library supports tab-separation between a word's name, count, and pronunciation, as well as both DOS- and UNIX-style newlines.

data DX1Entry

Stores a word, its number of occurrences, and its phonemes.

Instances

  • Eq DX1Entry
  • Read DX1Entry
  • Show DX1Entry

Calculations

sumCounts :: [DX1Entry] -> Int

Sum the counts of each DX1Entry in a list.

frequencies :: [DX1Entry] -> [(DX1Entry, Float)]

Pair each DX1Entry in a list with its frequency.

sortedFrequencies :: [DX1Entry] -> [(DX1Entry, Float)]

O(nlog n). Sort each DX1Entry in a list by its frequency.

Parser

parseDX1 :: String -> Either ParseError [DX1Entry]

Parses a .dx1 file to a list of DX1Entrys (uses Parsec internally).

Example Program

main :: IO ()

O(nlog n). Parses a .dx1 file from stdin or a given filename, computes the frequency of each word, sorts by frequency in ascending order, and prints the result.

Produced by Haddock version 2.11.0. Munged by Pandoc version 1.9.4.2. Cleaned by hand.

dx1's People

Contributors

markandrus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.