Git Product home page Git Product logo

tategakibunko / typenovel Goto Github PK

View Code? Open in Web Editor NEW
89.0 9.0 2.0 694.3 MB

A simple markup language to write novel with types.

Home Page: https://github.com/tategakibunko/TypeNovel/tree/master/Docs/README.md

License: Other

Makefile 0.46% TypeScript 89.06% JavaScript 5.13% Nearley 5.35%
novel natural-language-processing machine-learning markup-language compiler writing writing-tool typescript

typenovel's Introduction

TypeNovel

A simple markup language to write novel with types.

Example

This is what it looks like.

@scene({
  season:"winter"
}){
  Finally, $season("Xmas") has come!
}

Output is here.

<scene data-season="winter">
  Finally, <season>Xmas</season> has come!
</scene>

For more information, take a look at Cheatsheet.

Install

npm install -g typenovel

Then /usr/local/bin/tnc would be installed.

[foo@localhost] tnc --version
1.0.4

Use compiler from your project

You can compile from source by Tnc.fromString.

import { Tnc } from 'typenovel';

const result = Tnc.fromString('@scene(){ foo }', {
  format: 'html', // or 'text'
  minify: false
});

console.error(result.errors);
console.log(result.output);

Or you can compile from file by Tnc.fromFile.

import { Tnc } from 'typenovel';

const result = Tnc.fromFile('sample.tn', {
  format: 'html',
  minify: false
});

console.error(result.errors);
console.log(result.output);

Reader Application

Reader application is available for TypeNovel(compiler included).

Take a look at TypeNovelReader.

Motivation

What is the difference between pro novelist and amature novelist?

I'm running a novel posting platform over recent decades, and I always thought about differences between pro and amature.

I think that amature novelist sometimes lack some context description in their story, especially tend to lack the time description.

To confirm this feeling, I measured the scores how many times they wrote time in their novel, and gave them quolity scores.

The formula is simple.

[Total count of time written sentence] * [Entropy of time written sentence] / [Total sentence count]

For example, score of "Mon"('門' in Japanese) written by 'Natsume Soukeki (1867-1916)' is like this.

histgram: [30, 24, 33, 21, 29, 29, 30, 24, 24, 17]
score: 0.221913(total sentence size = 3879, total time sentences = 261, entropy = 3.298082)

In this way, I measured the average scores of many writers in my platform.

Here is scores of amature writers.

user1: average score:0.055084
user2: average score:0.057143
user3: average score:0.020505
user4: average score:0.071971
user5: average score:0.045247
user6: average score:0.042603
user7: average score:0.086316
user8: average score:0.051926
user9: average score:0.089533

And here is scores of pro writers.

pro1: average score:0.120076, Arthur Conan Doyle
pro2: average score:0.210235, Anton Pavlovich Chekhov
pro3: average score:0.124371, James Augustine Aloysius Joyce
pro4: average score:0.101132, Feodor Dostoyevsky
pro5: average score:0.138546, Nomura Kodou(野村胡堂)
pro6: average score:0.153463, Mori Ougai(森鴎外)
pro7: average score:0.148902, Christian Andersen
pro8: average score:0.110636, Natsume Souseki(夏目漱石)
pro9: average score:0.118976, Nakajima Atsushi(中島敦)

Clearly pro scores around 0.1, but amature scores around 0.05, difference is not so small.

So I thought "How can we fill the differences between pro and amature?".

In other words, "Can we fill the diffecence using some kind of technology?".

My answer is "novel with type"

I think we can force all writers to fill enough information in their text, to use typing.

But what is the type of novel?

I think it's pair of constraint and annotation.

This is what it looks like.

// block level tag starts with '@'
@scene({
  season: "winter", // constraint 'season'
  time: "7:00AM" // constraint 'time'
}){
  // annotation tag starts with '$'.
  // annotated constraint 'time(7:00AM)' as 'morning'
  I woke up at the $time("morning"). // I woke up at the morning.

  // annotated constraint 'season(winter)' as 'Xmas'
  Finally $season("Xmas")!
}

In this example, we have two constraints(season as "winter" and time as "7:00AM") for this scene block.

So we have to annotate them by writing annotation tag.

And we annotated them by $time("morning") and $season("Xmas").

Now we annotated all constraints, let's compile this code!

[foo@localhost]$ tnc sample.tn

And you get html output like this.

<scene data-season="winter" data-time="7:00AM">
  I woke up at the <time>morning</time>.
  "Finally <season>Xmas</season>!"
</scene>

This output is NLP(Natural Language Processing) or ML(Machine Leraning) friendly, so both platform and writers win!

Writers merit: quality of novel

Platform merit: quality of data

By the way, if we don't annotated our constraints, what happens?

Offcource, you'll get errors at the compilation time.

/Users/u1/sample.tn(line:1) 'season' is not annotated in this block!
/Users/u1/sample.tn(line:2) 'time' is not annotated in this block!

typenovel's People

Contributors

cmplstofb avatar objectx avatar tategakibunko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

objectx frodo821

typenovel's Issues

Windowsの配布バイナリで "An assembly specified in the application dependencies manifest" が出る

問題

Windows 10 下でバイナリファイルをダウンロードし、解凍して利用しようとしたところ、以下のようなエラーが出てしまいました。

C:\Users\eseha\Tnc>tnc testnovel.tc
Error:
  An assembly specified in the application dependencies manifest (Tnc.deps.json) was not found:
    package: 'Argu', version: '5.5.0'
    path: 'lib/netstandard2.0/Argu.dll'

何らかのパッケージ依存が解決されていないと考え、.NET Core 2.2 をインストールした後に、再起動も試してみましたが、依然として同じ問題が出てきてしまいます。

もしかすると、同じような問題で試すことが出来ない人もいるかと考え、Issueで投げてみることにしました。よろしくお願いします。

環境

  • Windows 10
  • .NET Core 2.2 インストール済

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.