Can I use Python Library at Ruby On Rail?

Asked 2 years ago, Updated 2 years ago, 30 views

Can I use Comoran, which analyzes Korean morphemes in Python libraries, to use it in the Ruby On Rails project?

python ruby-on-rails ruby

2022-09-21 15:57

1 Answers

I don't know about Python, but... Looking at the comoran, it seems to be provided in the form of a jar file.

(1) If you use JRuby, you can call Jar files directly and use them. However, if you use Rails in JRuby, there will be many problems.

(2) As long as you receive the results of morpheme analysis, you can create a Java program that you use by calling the jar file of the comoran, and then run the Java code in ruby. For example, a Java file can be: It is a program that outputs argv[0] as it is entered as a factor from an execution command.

public class A{

  public static void main(String[]argv){
    System.out.println(argv[0]);
  }
}

javac A.java

So I made A.class file

java A hello

If you type that, the screen will say hello. To run this in ruby, in ruby

result = `java A abc`

You can say that. javaAabc is not a single quote, but a letter (called backtick) under the left wave pattern of number 1.

This will result in abc, which is the result of running Java.


2022-09-21 15:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.