unity-sentis
ONNX
PB Unity commited on
Commit
e09c786
1 Parent(s): 998471f

Upload RunJets.cs

Browse files
Files changed (1) hide show
  1. RunJets.cs +6 -9
RunJets.cs CHANGED
@@ -134,23 +134,20 @@ public class RunJets : MonoBehaviour
134
  {
135
  string output = "";
136
  int start = 0;
137
- for (int i = word.Length; i >= 0 && start < word.Length ; i--)
138
  {
139
- if (i <= start)
140
  {
141
  start++;
142
- i = word.Length + 1;
143
  continue;
144
  }
145
- //Debug.Log(word.Length + " " + i + " " + start);
146
- string subword = word.Substring(start, i - start);
147
  if (dict.TryGetValue(subword, out string value))
148
  {
149
- // Debug.Log("FOUND");
150
  output += value + " ";
151
- if (i == word.Length) break;
152
- start = i;
153
- i = word.Length + 1;
154
  }
155
  }
156
  return output;
 
134
  {
135
  string output = "";
136
  int start = 0;
137
+ for (int end = word.Length; end >= 0 && start < word.Length ; end--)
138
  {
139
+ if (end <= start) //no matches
140
  {
141
  start++;
142
+ end = word.Length + 1;
143
  continue;
144
  }
145
+ string subword = word.Substring(start, end - start);
 
146
  if (dict.TryGetValue(subword, out string value))
147
  {
 
148
  output += value + " ";
149
+ start = end;
150
+ end = word.Length + 1;
 
151
  }
152
  }
153
  return output;