Dictionary

From UBC Wiki

Overview

What is the problem?

  • We want to implement a client written in Haskell which will send and receive information such as queries and definitions using the socket.
  • We will be networking with Haskell and implementing a parser within Haskell. Additionally we will be formatting and sending queries using the socket.
  • We aim to interact with dict.org specifically.

What is something extra?

  • Users can choose different dictionaries from the available options.
  • Users can review each definition of the word they look up or start a new search by pressing appropriate keys.
  • ANSI escape codes are utilized to enhance console output, resulting in an improved user experience.
  • Word suggestions are offered in response to word input that is potentially misspelled.

What did we learn from doing this?

We learned how to use Network sockets and install libraries in Haskell using cabal. We used Network for connecting to dict.org and Ansi-terminal for colour, and we wrote our own modules to piece together our project. We solidified our understanding of pattern matching, especially in the context of Strings or [Char]. Initially, some of us found it difficult to write functions that each did very little, but later realized that because of this, writing a small CUI application in a functional language like Haskell is actually quite fast and straightforward.


The bottomline for our project is that it should successfully connect to a dictionary, allow the user to choose which dictionary to search from a list of options, display word suggestions, and display the definitions in the response. We intentionally chose to omit certain details in the dictionary response to reduce bloat and redundancy.


Functional programming is suitable for our task of creating a dictionary client with word suggestions. We found pattern matching to be especially useful for parsing dictionary responses for different databases. The use of recursion and IO to simulate an interactive CUI was sufficient, and the splitting of different responsibilities into several modules and many small functions was appropriate. Finally, although both functional and imperative paradigms do not change the underlying performance of the merge sort used in our word suggestions, the latter seems easier to comprehend and implement. However, the somewhat imperative-style manner of the do blocks available in Haskell did facilitate the process and made the task less cumbersome.

Work division

N/A

Link to project

https://github.students.cs.ubc.ca/eswlo/HSDict.git