Code Monkey home page Code Monkey logo

bookindexer's Introduction

BookIndexer

Book's index table

Java project with the purpose to generate an index table in an output file.

The file must always start with the string "INDEX" The next n lines contain the locations of each of the n keywords, sorted alphabetically:

  • Each line must start with the keyword itself, followed by a comma and a space
  • The indexes of the words follow. If a word is found several times, display them all separated by commas. If a word is found on consequent pages display the range of pages with a dash as in 150-152 instead of 150, 151, 152.
  • The indexer is case-insenstive - consider "Hello" and "hello" are the same word.

Here's an example:

Contents of the book file:

=== Page 1 ===
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut rhoncus non odio sed ultricies. Pellentesque dui metus, cursus at neque eget, sollicitudin sagittis lorem. Nullam semper ex et rutrum tincidunt.

=== Page 2 ===
Aenean porta velit et ex fermentum, vitae finibus diam elementum. Vivamus dapibus purus dolor, quis ultricies orci ornare eu. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque sed purus rhoncus, dignissim nunc non, laoreet tortor. 

== Page 3 ===
Integer blandit sem nulla, in pretium augue finibus quis. Ut elementum augue vel dignissim accumsan. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec blandit libero.

Keywords:

String[] keywords = new String[] { "lorem", "quisque", "aenean" };

Then the output index file should look like this:

INDEX
aenean, 2
lorem, 1, 3
quisque, 2-3

bookindexer's People

Contributors

rositsazz avatar

Watchers

James Cloos 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.