Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by hadiw3i · Nov 06, 2014 at 05:01 AM · c#errorword

Show Strings With Last Characters of the first Word

Hello There Senior Programmer of Unity3d.. Can i ask u something about how to show 5 Words just like : Apple, Electro, Organic, Champ, and Pen First i want to show words "Apple" and following by "Electro" and "Organic" and etc but the first words "Apple" must be showed first and then the second words is taken from last character of the first Word "Apple --> E" and the Second character show up "Electro" and etc Example: 1. ApplE 2. ElectrO 3. OrganiC 4. ChamP 5. Pen

Could u help me to solve this problem? sorry for bothering u all with some questions like this..

Best Regards, Hadi From indonesia

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hadiw3i · Nov 06, 2014 at 04:09 AM 0
Share

Yepp.. I'm Using Speech Recognition.. i've tried to show the first words and it's succeed.. but.. if i want to show the second word with the last character of the first word i've failed.. Thx for your comment

avatar image hadiw3i · Nov 06, 2014 at 04:17 AM 0
Share

IEnumerator DoRecording() { Debug.Log("Recording"); audio.clip = $$anonymous$$icrophone.Start(null, false, 3, 8000); yield return new WaitForSeconds(3); Debug.Log("Playing"); audio.Play(); $$anonymous$$icrophone.End(null);

     float[] clipData = new float[audio.clip.samples * audio.clip.channels];
     audio.clip.GetData(clipData, 0);
     
     //Format to 8$$anonymous$$Hz sampling rate
     WaveGen.WaveFormatChunk format = new WaveGen().$$anonymous$$akeFormat(audio.clip);
     
     string filename = "recordedSpeech.wav";
     FileStream stream = File.OpenWrite(filename);
     
     new WaveGen().Write(clipData, format, stream);
     stream.Close();

     ATT_$$anonymous$$SSD$$anonymous$$.Speechv3.SpeechResponse response = SpeechToTextService(filename, "Generic", "audio/wav");
     string speechOutput = response.Recognition.NBest[0].ResultText;
     Debug.Log(speechOutput);

     string text = speechOutput.ToLower();
     
     if (text.Contains ("apple")) 
     {
         Spawn();
     }
     
     speechText.text = text.ToString();

This is the code that i do.. but the problem is.. i want to show next character with the last character of "ApplE" it's meant E

avatar image NoseKills · Nov 06, 2014 at 07:17 AM 0
Share

Did I understand right? You need an algorithm that takes in an array of strings, starts from the first string and orders the rest so that each word starts with the letter the previous word ended with?

avatar image hadiw3i · Nov 06, 2014 at 08:00 AM 0
Share

Yes.. Thx for your comment.. i need that algorithm.. can u solve this problem sir? sorry for botherig u.. best regards..

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kiwasi · Nov 06, 2014 at 10:50 AM

Query, does your algorithm need to find the best path through the words? Or just a path?

To find any path:

  • Put all the unused words in an unused list

  • Grab a random word, remove it from the list and add it to a used list

  • Search the unused list for a word where the first letter (The string class has several methods that will help. You can also convert the string to a character array)

  • Remove the found word the unused list and add it to the used list

  • Repeat

You will have to define your behaviour once a match cannot be found.

To find the best possible path

  • Build a directed graph by linking each word to the possible follow on words

  • Starting from each node traverse the graph until a path is found which includes all nodes

There is a bunch of optimisations in graph theory that may be able to help. Consider first splitting the graph up into multiple sub graphs by checking for nodes that are impossible to reach. Also consider marking nodes that must be at the end or start of a chain. There may be some similarities to algorithms for finding the critical path.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

C# script error. 0 Answers

error CS8025: Parsing error in C# code 3 Answers

Why am I getting a parsing error? 1 Answer

Null in GetValidMethodInfo 0 Answers

C# Scripts don't work in Unity 3.5 any idea why? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges