/Bigram-boolean-search

A4: An updated boolean search program from A2

Primary LanguageScala

Prerequisites

  • OpenJDK 11.0.18.
  • Scala 2.13.10.
  • Install Scala (Metals) extension if you are using VS Code.
  • Clone this project: https://github.com/h3d-longnsp/Bigram-boolean-search.git.
  • Click the Import build prompt when open project or run Metals: Import Build manually in the command palette (ctrl+shift+P).

Build and run

  • Build the executable jar file for this project by open a terminal at the root folder and run sbt clean assembly.
  • Or run the pre-built bigram-boolean-search.jar in target/scala-2.13 by running java -jar bigram-boolean-search.jar.

Usage

1. Graphical interface

  • image
  • Shortcuts list:
Option Shortcut
Select a input folder Alt+F + Alt+O
Select an index file Alt+F + Alt+L
Display About dialog Alt+H + Alt+A
Build Vocabulary Alt+V
Build index Alt+B
Search the selected query Alt+E
Save the index Alt+S
Clear the search fields Alt+C
Exit the program Alt+F + Alt+P

2. Build vocabulary from input folder

  • Choose File>Select Input Folder to select an input folder. A select folder dialog will display for users to choose an input folder. image
  • Users can verify the path in the Input Folder text box. If the path is true then click the Build Vocab button. A loading dialog will appeared and the vocabulary for both unigram and bigram will be built. When done, the Vocabulary text box will display the total tokens count and the tokens. image
  • If users haven't chosen a input folder, click the Build Vocab button will display an error dialog to notify the users. image

3. Load an index file

  • Choose File>Load Index File to select an index file. A select file dialog will display for users to choose an index file. image
  • Users can verify the path in the Index File text box. A loading dialog will appeared and the chosen index will be loaded, the Index text box will display the total tokens count and the tokens with theirs corresponding documents ID. image

4. Build index

  • If users haven't built a vocabulary, click the Build Index button will display an error dialog to notify the users.image
  • When a vocabulary is built, the status label will change to green. Click the Build Index to build the index. A loading dialog will appeared and the index will be built. When done, the Index text box will display the total tokens count and the tokens with theirs corresponding documents ID. image image

5. Search

  • To use search, users need to build an index file or load an existing one.

  • There are 5 options to search for. Select the needed option and enter the terms then click Search! button. The result will be displayed in the Result text box. The query and the result count will be displayed in the Query text box.

  • If a term/terms is empty, an error dialog will be displayed to notify the users.image

  • Examples:

    • Search a single term: image
    • Search AND: image
    • Search OR: image
    • Search AND NOT: image
    • Search OR NOT: image
  • To clear all the fields in Search, click the Clear button. image

  • To save the present index, click the Save button. A save dialog will appeared and the users will choose the name and location to save the index.image image