Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regenerate glue code by SWIG 4.0.1 #11

Merged
merged 11 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 153 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ on:

jobs:
test-linux:
name: test on linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: test mecab
run: |
./configure
make
make -j2
make check
sudo make install
sudo ldconfig
Expand Down Expand Up @@ -65,3 +66,154 @@ jobs:
sudo make install
make clean
working-directory: mecab-jumandic

test-linux-perl:
name: test perl bindings
runs-on: ubuntu-latest
strategy:
matrix:
perl:
- '5.30'
- '5.28'
- '5.26'
- '5.24'
- '5.22'
- '5.20'
steps:
- uses: actions/checkout@v2
- name: install mecab
run: |
./configure
make -j2
sudo make install
sudo ldconfig
working-directory: mecab
- name: install ipadic utf-8
run: |
./configure --with-charset=utf8
make
sudo make install
working-directory: mecab-ipadic
- name: setup perl ${{ matrix.perl }}
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
- run: perl -V
- name: build and test
run: |
perl Makefile.PL
make
make test
working-directory: mecab/perl

test-linux-python:
name: test python bindings
runs-on: ubuntu-latest
strategy:
matrix:
python:
- '3.8'
- '3.7'
- '3.6'
- '3.5'
steps:
- uses: actions/checkout@v2
- name: install mecab
run: |
./configure
make -j2
sudo make install
sudo ldconfig
working-directory: mecab
- name: install ipadic utf-8
run: |
./configure --with-charset=utf8
make
sudo make install
working-directory: mecab-ipadic
- name: setup python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- run: python -V
- name: build and test
run: |
python setup.py build
python setup.py install
python test.py
working-directory: mecab/python

test-linux-ruby:
name: test ruby bindings
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- '2.4'
- '2.5'
- '2.6'
steps:
- uses: actions/checkout@v2
- name: install mecab
run: |
./configure
make -j2
sudo make install
sudo ldconfig
working-directory: mecab
- name: install ipadic utf-8
run: |
./configure --with-charset=utf8
make
sudo make install
working-directory: mecab-ipadic
- name: setup ruby ${{ matrix.ruby }}
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: ruby -v
- name: build and test
run: |
ruby extconf.rb
make
make install
ruby test.rb
working-directory: mecab/ruby

test-linux-java:
name: test java bindings
runs-on: ubuntu-latest
strategy:
matrix:
java:
- '8'
- '9'
- '10'
- '11'
- '12'
- '13'
steps:
- uses: actions/checkout@v2
- name: install mecab
run: |
./configure
make -j2
sudo make install
sudo ldconfig
working-directory: mecab
- name: install ipadic utf-8
run: |
./configure --with-charset=utf8
make
sudo make install
working-directory: mecab-ipadic
- name: setup java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- run: java -version
- name: build and test
run: |
make
make test
working-directory: mecab/java
10 changes: 5 additions & 5 deletions content/bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ print m.parse ("今日もしないとね")
import sys
import MeCab
m = MeCab.Tagger ("-Ochasen")
print m.parse ("今日もしないとね")
print (m.parse ("今日もしないとね"))
```

### Java
Expand Down Expand Up @@ -103,9 +103,9 @@ RuntimeError 例外が発生します.
```python
try:
m = MeCab.Tagger ("-d .")
print m.parse ("今日もしないとね")
except RuntimeError, e:
print "RuntimeError:", e;
print (m.parse ("今日もしないとね"))
except RuntimeError as e:
print ("RuntimeError:", e)
```


Expand Down Expand Up @@ -142,7 +142,7 @@ n2 = m.parseToNode ("さくさくさくら")

# n1 の内容は無効になっている
while (n1.hasNode () != 0):
print n1.getSurface ()
print (n1.getSurface ())
n1 = n1.next ()
```

Expand Down
10 changes: 5 additions & 5 deletions docs/bindings.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h3 id="perl">perl</h3>
<div class="highlight"><pre style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-python" data-lang="python"><span style="color:#00f">import</span> sys
<span style="color:#00f">import</span> MeCab
m = MeCab.Tagger (<span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">-Ochasen</span><span style="color:#a31515">&#34;</span>)
<span style="color:#00f">print</span> m.parse (<span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">今日もしないとね</span><span style="color:#a31515">&#34;</span>)
<span style="color:#00f">print</span> (m.parse (<span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">今日もしないとね</span><span style="color:#a31515">&#34;</span>))
</code></pre></div><h3 id="java">Java</h3>
<div class="highlight"><pre style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#00f">import</span> org.chasen.mecab.Tagger;
<span style="color:#00f">import</span> org.chasen.mecab.Node;
Expand Down Expand Up @@ -82,9 +82,9 @@ <h3 id="perl">perl</h3>
ごらんください. 以下は, <a href="http://www.python.org" title="python">python</a> の例です</p>
<div class="highlight"><pre style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-python" data-lang="python"><span style="color:#00f">try</span>:
m = MeCab.Tagger (<span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">-d .</span><span style="color:#a31515">&#34;</span>)
<span style="color:#00f">print</span> m.parse (<span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">今日もしないとね</span><span style="color:#a31515">&#34;</span>)
<span style="color:#00f">except</span> RuntimeError, e:
<span style="color:#00f">print</span> <span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">RuntimeError:</span><span style="color:#a31515">&#34;</span>, e;
<span style="color:#00f">print</span> (m.parse (<span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">今日もしないとね</span><span style="color:#a31515">&#34;</span>))
<span style="color:#00f">except</span> RuntimeError <span style="color:#00f">as</span> e:
<span style="color:#00f">print</span> (<span style="color:#a31515"></span><span style="color:#a31515">&#34;</span><span style="color:#a31515">RuntimeError:</span><span style="color:#a31515">&#34;</span>, e)
</code></pre></div><h2 id="heading-5">注意事項</h2>
<h3 id="heading-6">文頭,文末形態素</h3>
<p><code>parseToNode</code> の返り値は, 「文頭」という特別な形態素を示す <code>MeCab::Node</code>
Expand All @@ -109,7 +109,7 @@ <h3 id="heading-6">文頭,文末形態素</h3>

<span style="color:#008000"># n1 の内容は無効になっている</span>
<span style="color:#00f">while</span> (n1.hasNode () != 0):
<span style="color:#00f">print</span> n1.getSurface ()
<span style="color:#00f">print</span> (n1.getSurface ())
n1 = n1.next ()
</code></pre></div><p>上記の例では, <code>n1</code> の指す中身が, 「さくさくさくら」を解析した時点で
上書きされており, 使用できなくなっています.</p>
Expand Down
49 changes: 26 additions & 23 deletions mecab/csharp/DictionaryInfo.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.4
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.1
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------

namespace MeCab {

using System;
using System.Runtime.InteropServices;

public class DictionaryInfo : IDisposable {
private HandleRef swigCPtr;
public class DictionaryInfo : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;

internal DictionaryInfo(IntPtr cPtr, bool cMemoryOwn) {
internal DictionaryInfo(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}

internal static HandleRef getCPtr(DictionaryInfo obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DictionaryInfo obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}

~DictionaryInfo() {
Dispose();
Dispose(false);
}

public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}

public virtual void Dispose() {
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
MeCabPINVOKE.delete_DictionaryInfo(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}

Expand Down Expand Up @@ -99,8 +102,8 @@ public ushort version {

public DictionaryInfo next {
get {
IntPtr cPtr = MeCabPINVOKE.DictionaryInfo_next_get(swigCPtr);
DictionaryInfo ret = (cPtr == IntPtr.Zero) ? null : new DictionaryInfo(cPtr, false);
global::System.IntPtr cPtr = MeCabPINVOKE.DictionaryInfo_next_get(swigCPtr);
DictionaryInfo ret = (cPtr == global::System.IntPtr.Zero) ? null : new DictionaryInfo(cPtr, false);
if (MeCabPINVOKE.SWIGPendingException.Pending) throw MeCabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
Expand Down
Loading