Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
Simpla still
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrahams committed Jan 17, 2025
1 parent 2cb43e1 commit d69a409
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
25 changes: 2 additions & 23 deletions Sources/Lotsawa/Chart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,29 +295,8 @@ extension Chart {

extension Chart {

struct Predictions: RandomAccessCollection {
typealias Base = PredictionSet

let earleme: UInt32
let base: Base

typealias Element = Chart.ItemID
typealias Index = Base.Index
var startIndex: Index { base.startIndex }
var endIndex: Index { base.endIndex }

subscript(p: Base.Index) -> Element {
var i = base[p]
i.origin = earleme
return i
}
}

func predictions(startingWith transitionSymbol: Symbol, inEarleySet origin: UInt32) -> Predictions {
Predictions(
earleme: origin,
base: predictionMemo.predictions(
inEarleme: Int(origin), startingWith: transitionSymbol))
func predictions(startingWith transitionSymbol: Symbol, inEarleySet origin: UInt32) -> PredictionSet {
predictionMemo.predictions(inEarleme: Int(origin), startingWith: transitionSymbol)
}

}
3 changes: 2 additions & 1 deletion Sources/Lotsawa/Recognizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ extension Recognizer {

// The set containing potential mainstem derivations to be paired with the one for s.
let predictions = chart.predictions(startingWith: s, inEarleySet: origin)
for m in predictions {
for var m in predictions {
m.origin = origin
derive(.init(item: m.advanced(in: g), mainstemIndex: nil))
}

Expand Down

0 comments on commit d69a409

Please sign in to comment.