package module
Version: v0.0.0-...-4a99208 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2019 License: Apache-2.0 Imports: 13 Imported by: 0



DEPRECATED (RETIRED) This repository is now retired, achived and no longer maintained - note particularly that security updates are NO LONGER being performed.

Web service to align free text to curriculum standards as document classification

NOTE: This is experimental and proof-of-concept code

This code builds on, putting in place a document classifier (–idf) to classify arbitrary text as aligning to the curriculum items the code is provisioned with, and outputting the alignments as a web service.

Binary distributions of the code are available in the build/ directory.

The web service is made available as a library (Align()); the cmd directory contains a sample shell for it, which is used in the binary distribution. In the sample shell, the web service runs on port 1576. The test script issues representative REST queries against the web service.

The web service takes the following arguments:

GET http://localhost:1576/align?yr=X,Y,Z&area=W&text=....

where yr is the year level (and can be comma-delimited), area is the learning area, and text is the text to be aligned. The text parameter is obligatory. If no year is provided, all years in the curricula are matched; if no learning area is provided, all learning areas in the curricula are matched.

For example:


The response is a JSON list of structs, one for each curriculum standard that the service is configured for, with the following fields:

  • Item: the identifier of the curriculum item whose alignment is reported
  • LearningArea: the learning area of the curriculum item whose alignment is reported
  • Text: the text of the curriculum item whose alignment is reported
  • Score: the score of the alignment. This is the score generated by it is a negative number, and the higher the number (i.e. the closer to zero), the better the alignment of the text to the curriculum standard.
  • Matches: the top five words that were the basis for the alignment of the curriculum item to the text
    • Text: the matching word
    • Score: the logarithmic score

The documents passed to the document classifier are also indexed, and can be queried through the web service index:

GET http://localhost:1576/index?search=word

To use embedded in other labstack.echo webservers, replicate the cmd/main.go main() code:

e := echo.New()
e.GET("/align", align.Align)
e.GET("/index", func(c echo.Context) error {
                query := c.QueryParam("search")
                ret, err := align.Search(query)
                if err != nil {
                        return err
                } else {
                        return c.String(http.StatusOK, string(ret))

The curricula that the web service is configured to read are JSON files in the curricula folder of the executable; in this distribution, sample files are in cmd/curricula. The JSON structure required is an array of JSON objects, with the following keys:

  • Item (string): the curriculum standard code.
  • Year ([]string): the year levels to which the curriculum standard applies. (NSW Syllabus stages are to be translated to year levels).
  • LearningArea (string): the learning area of the curriculum standard
  • Strand (string): the strand of the curriculum standard
  • Substrand (string): the substrand of the curriculum standard
  • Text (string): the text of the curriculum standard
  • Elaboration (string): the elaboration text of the curriculum standard


The word "curriculum" began as a Latin word which means "a race" or "the course of a race" (which in turn derives from the verb currere meaning "to run/to proceed"). The first known use in an educational context is in the Professio Regia, a work by University of Paris professor Petrus Ramus published posthumously in 1576.




This section is empty.


This section is empty.


func Align

func Align(c echo.Context) error

func Init

func Init()


type AlignmentType

type AlignmentType struct {
	Item         string
	Text         string
	Score        float64
	LearningArea string
	Matches      []bayesian.MatchStruct

type ClassifierType

type ClassifierType struct {
	Classifier *bayesian.Classifier
	Classes    []bayesian.Class

type Curriculum

type Curriculum struct {
	Item         string
	Year         []string
	LearningArea string
	Strand       string
	Substrand    string
	Text         string
	Elaboration  string
	AC_Content   string `json:"AC content"`


Path Synopsis
A Naive Bayesian Classifier Jake Brukhman <> BAYESIAN CLASSIFICATION REFRESHER: suppose you have a set of classes (e.g.
A Naive Bayesian Classifier Jake Brukhman <> BAYESIAN CLASSIFICATION REFRESHER: suppose you have a set of classes (e.g.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL