Skip to content

Commit

Permalink
Rename and rebrand to dictpress / DictPress.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Dec 11, 2021
1 parent 813056a commit 199f210
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 91 deletions.
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ env:
- CGO_ENABLED=0

builds:
- binary: dictmaker
main: ./cmd/dictmaker
- binary: dictpress
main: ./cmd/dictpress
goos:
- darwin
- linux
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Contributing

To get dictmaker compiled on your own local system:
To compile the app on your own local system:

0. Make sure you have `go` installed.
1. Clone this repository on to your computer.
2. Switch to the folder.
3. Run `make`
4. `./dictmaker` is now available
4. `./dictpress` is now available
5. Follow the rest of "Installation" instruction in README.md

To configure the `[db]` section of `config.toml`, you will need a postgres instance running on your computer.
Expand All @@ -15,4 +15,4 @@ To configure the `[db]` section of `config.toml`, you will need a postgres insta

1. Install postgresql.
2. `createuser` and `createdb`. Fill config.toml with these details.
3. `psql -Upostgres dictmaker -f sample/sample.sql`
3. `psql -Upostgres dictpress -f sample/sample.sql`
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ LAST_COMMIT := $(shell git rev-parse --short HEAD)
VERSION := $(shell git describe --tags --abbrev=0)
BUILDSTR := ${VERSION} (\#${LAST_COMMIT} $(shell date -u +"%Y-%m-%dT%H:%M:%S%z"))

STATIC := config.toml.sample schema.sql queries.sql admin
BIN := dictmaker
STATIC := config.sample.toml schema.sql queries.sql admin
BIN := dictpress

# Install dependencies needed for building
.PHONY: deps
Expand Down
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# dictmaker
![dictmaker](https://user-images.githubusercontent.com/547147/63648814-ade19a80-c752-11e9-9c63-cbf5dfb2269e.png)
# DictPress

**dictmaker** is a stand-alone, single-binary server application for building and publishing dictionary websites. [Alar](https://alar.ink) (Kannada-English dictionary) is an example in production.
**DictPress** is a stand-alone, single-binary server application for building and publishing dictionary websites. [Alar](https://alar.ink) (Kannada-English dictionary) is an example in production.

- Generic entry-relation (many)-entry structure for dictionary data in a Postgres database with just two tables (entries, relations)
- Entirely built on top of Postgres full text search using [tsvector](https://www.postgresql.org/docs/10/datatype-textsearch.html) tokens
Expand All @@ -12,7 +11,7 @@
- Paginated A-Z (or any alphabet for any language) glossary generation for dictionary words

## How it works
dictmaker has no concept of language or semantics. To make a universal dictionary interface possible, it treats all data as unicode strings that can be searched with Postgres DB's fulltext capabilities, where search tokens are generated and stored along with the dictionary entries. There are several built-in fulltext dictionaries and tokenizers that Postgres supports out of the box, mostly European languages (`\dFd` lists installed dictionaries). For languages that do not have fulltext dictionaries, it is possible to generate search tokens manually using an external algorithm. For instance, to make a phonetic English dictionary, [Metaphone](https://en.wikipedia.org/wiki/Metaphone) tokens can be generated manually and search queries issued against them.
DictPress has no concept of language or semantics. To make a universal dictionary interface possible, it treats all data as unicode strings that can be searched with Postgres DB's fulltext capabilities, where search tokens are generated and stored along with the dictionary entries. There are several built-in fulltext dictionaries and tokenizers that Postgres supports out of the box, mostly European languages (`\dFd` lists installed dictionaries). For languages that do not have fulltext dictionaries, it is possible to generate search tokens manually using an external algorithm. For instance, to make a phonetic English dictionary, [Metaphone](https://en.wikipedia.org/wiki/Metaphone) tokens can be generated manually and search queries issued against them.

### Concepts
- There can be any number of languages defined in the dictionary. eg: 'english', 'malayalam', 'kannada' etc.
Expand All @@ -22,7 +21,7 @@ dictmaker has no concept of language or semantics. To make a universal dictionar
## entries table schema
| `id` | `SERIAL` | |
|-----------|------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `guid` | `TEXT` | A custom, unique GUID for every entry, like a UUID or a hash |
| `guid` | `TEXT` | UUID used in public facing APIs |
| `content` | `TEXT` | Actual language content. Dictionary word or definition entries |
| `initial` | `TEXT` | The first "alphabet" of the content. For English, for the word `Apple`, the initial is `A` |
| `weight` | `INT` | An optional numeric value to order search results |
Expand All @@ -42,12 +41,12 @@ dictmaker has no concept of language or semantics. To make a universal dictionar
| `notes` | `TEXT` | Optional text notes |

# Installation
1. Download the latest release [release](https://github.com/knadh/dictmaker/releases).
1. Run `./dictmaker --new` to generate a sample config.toml. Edit the config.
1. Download the latest release [release](https://github.com/knadh/dictpress/releases).
1. Run `./dictpress --new` to generate a sample config.toml. Edit the config.
1. Define your dictionary's languages and properties along with other config in `config.toml`
1. Run `./dictmaker --install` to install the Postgres DB schema.
1. Run `./dictpress --install` to install the Postgres DB schema.
1. Populate the `entries` and `relations` tables with your dictionary data. See the "Sample dictionary" section below
1. Run the dictionary server: `./dictmaker`
1. Run the dictionary server: `./dictpress`

## Dictionary query API
```shell
Expand All @@ -66,9 +65,6 @@ curl localhost:8080/api/dictionary/english/italian/apple
```

## Themes
See the [alar-dict/alar.ink](https://github.com/alar-dict/alar.ink) repository that powers the [Alar](https://alar.ink) dictionary. A theme is a directory with a collection of Go HTML templates. Run a theme by passing `./dictmaker --site=theme_dir`.

## Tokenizer plugins
For languages that do not have Postgres fulltext dictionaries and tokenizers, dictmaker supports loading compiled Go tokenizer plugins that implement the `search.Tokenizer` interface. See `tokenizers/kannada` (and `Makefile` for compilation help).
See the [alar-dict/alar.ink](https://github.com/alar-dict/alar.ink) repository that powers the [Alar](https://alar.ink) dictionary. A theme is a directory with a collection of Go HTML templates. Run a theme by passing `./dictpress --site=theme_dir`.

Licensed under the AGPL v3 license.
2 changes: 1 addition & 1 deletion admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ .Title }} {{ if .Title }}|{{ end}} dictmaker</title>
<title>{{ .Title }} {{ if .Title }}|{{ end}} DictPress</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/admin/static/grid.css">
<link rel="stylesheet" type="text/css" href="/admin/static/style.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictpress/internal/data"
"github.com/labstack/echo/v4"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/dictmaker/handlers.go → cmd/dictpress/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictpress/internal/data"
"github.com/knadh/paginator"
"github.com/labstack/echo/v4"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/dictmaker/init.go → cmd/dictpress/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"path/filepath"

"github.com/jmoiron/sqlx"
"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictmaker/tokenizers/indicphone"
"github.com/knadh/dictpress/internal/data"
"github.com/knadh/dictpress/tokenizers/indicphone"
"github.com/knadh/koanf"
"github.com/knadh/stuffbin"
"github.com/labstack/echo/v4"
Expand Down Expand Up @@ -47,7 +47,7 @@ func initFS() stuffbin.FileSystem {
logger.Printf("using local filesystem for static assets")

files := []string{
"config.toml.sample",
"config.sample.toml",
"queries.sql",
"schema.sql",
"admin",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/dictmaker/main.go → cmd/dictpress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"

"github.com/jmoiron/sqlx"
"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictpress/internal/data"
"github.com/knadh/goyesql"
goyesqlx "github.com/knadh/goyesql/sqlx"
"github.com/knadh/koanf"
Expand Down
2 changes: 1 addition & 1 deletion cmd/dictmaker/site.go → cmd/dictpress/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/url"
"strings"

"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictpress/internal/data"
"github.com/knadh/paginator"
"github.com/labstack/echo/v4"
)
Expand Down
2 changes: 1 addition & 1 deletion config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ root_url = "http://localhost:9000"
# with the name {{ define "page-about" }}. All template name definitions
# should be "page-*".
#
# This is relevant when starting dictmaker with a site theme (--site param).
# This is relevant when starting the app with a site theme (--site param).
enable_pages = false


Expand Down
58 changes: 0 additions & 58 deletions config.toml.sample

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/knadh/dictmaker
module github.com/knadh/dictpress

go 1.17

Expand Down
2 changes: 1 addition & 1 deletion tokenizers/indicphone/indicphone.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictpress/internal/data"
"github.com/knadh/knphone"
"gitlab.com/joice/mlphone-go"
)
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/kannada/kannada.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictpress/internal/data"
"github.com/knadh/knphone"
)

Expand Down
2 changes: 1 addition & 1 deletion tokenizers/malayalam/malayalam.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"github.com/knadh/dictmaker/internal/data"
"github.com/knadh/dictpress/internal/data"
"gitlab.com/joice/mlphone-go"
)

Expand Down

0 comments on commit 199f210

Please sign in to comment.