Code Monkey home page Code Monkey logo

mikan.js's Introduction

Mikan.js - 機械学習を用いていない日本語改行問題へのソリューション

mikan.jsは、正規表現を用いた簡易形態素解析による、単語の改行問題への解決策を提供します。 demo

インストール

npm install mikanjs

使い方

nodeで用いる場合

const mikan = require('mikanjs');
console.log(mikan('常に最新、最高のモバイル。Androidを開発した同じチームから。'));
/*
<span style="display:inline-block" role="presentation">常に</span>
<span style="display:inline-block" role="presentation">最新、</span>
<span style="display:inline-block" role="presentation">最高の</span>
<span style="display:inline-block" role="presentation">モバイル。</span>
<span style="display:inline-block" role="presentation">Androidを</span>
<span style="display:inline-block" role="presentation">開発した</span>
<span style="display:inline-block" role="presentation">同じ</span>
<span style="display:inline-block" role="presentation">チームから。</span>
*/

console.log(mikan.split('常に最新、最高のモバイル。Androidを開発した同じチームから。'));
// ['常に', '最新、', '最高の', 'モバイル。', 'Androidを', '開発した', '同じ', 'チームから。']

Webで用いる場合

<div id="sample"></div>
<script src="mikan.js"></script>
<script>
  var sampleElement = document.getElementById('sample');
  sampleElement.innerHTML = Mikan('常に最新、最高のモバイル。Androidを開発した同じチームから。');
</script>

Reactで用いる場合

<div dangerouslySetInnerHTML={{__html : Mikan('常に最新、最高のモバイル。Androidを開発した同じチームから。')}} />

もしくは

{Mikan.split('常に最新、最高のモバイル。Androidを開発した同じチームから。').map((text) => <span>{text}</span>)}

mikan.js's People

Contributors

trkbt10 avatar nzmosh avatar txantslusam avatar simeonc avatar hideokamoto avatar pinalto avatar

Watchers

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