Coder Social home page Coder Social logo

hanzi2pinyinengine's Introduction

Hi there 👋  

hanzi2pinyinengine's People

Contributors

dongyuwei avatar olament avatar sgrayrw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hanzi2pinyinengine's Issues

Pinyin2HanziEngine/SLMGraph.swift:121: Fatal error: Unexpectedly found nil while unwrapping an Optional value

when input nihaoshijie, the app crashed:

Pinyin2HanziEngine/SLMGraph.swift:121: Fatal error: Unexpectedly found nil while unwrapping an Optional value

https://github.com/Olament/Hanzi2PinyinEngine/blob/master/Pinyin2HanziEngine/Graphs/SLMGraph.swift#L121
var currentIndex = self.edgeTo[self.vertexCount - 1]!.from.id This line thrown the exception.

I tried refactor the code to prevent the exception, but then I can't get any solution result.

Also tried to check out 01bee8a47, it works, can get multiple senctences for the input nihaoshijie, but the sort/order looks odd, not correct.

Can you help to give some hint for this?

It returns only 1 result

Hi Olament, thanks for sharing the project.
I've cloned and checked that, but I found that the program only gave a result as the screenshot below.
The code in SMLGraph.swift also showed that It only gave a result as below.

// code in SLMGraph.swift , func of makSentence()
     func makeSentence() -> Solution {
        self.distanceTo[0] = 0 // set the starting vertex to zero

......
            while currentIndex != 0 {
                solution.pinyin = self.vertices[currentIndex].data!.pinyinSequence!.pinyinSequence + solution.pinyin
                solution.sentence = self.vertices[currentIndex].data!.phrase! + solution.sentence
                currentIndex = self.edgeTo[currentIndex]!.from.id
            }

.......
return solution
}

So, I just wonder that is this the final version of your code? Would you mind to update your final version of code which can give the multiple results?

Thanks a lot!

simulator_screenshot_494AC6CD-37DD-4317-9B04-53F95D0C8413

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.