Update README w/ fork info …
Update README w/ fork info
…
Note: This is the ARI fork of kennysong/SwiftEliza. Upstream doesn’t seem to incorporate PRs.
SwiftEliza is a Swift + iOS implementation of Weizenbaum’s ELIZA chatbot, which is a simulation of a Rogerian psychotherapist.
Based on kennysong’s Go implementation and QuestionBot from Apple’s App Development with Swift book.
To run, just open the SwiftEliza.xcodeproj in XCode.
SwiftEliza.xcodeproj
The functionality of ELIZA is contained in the Eliza.swift file, and the rest are boilerplate for the iOS app.
Eliza.swift
Written in Swift 3 for iOS 10 and above.
You can import Eliza as a regular Swift Package Manager package. To do so, use a Package.swift like this:
Package.swift
// swift-tools-version:5.0 import PackageDescription let package = Package( name: "MyEliza", dependencies: [ .package(url: "https://github.com/kennysong/SwiftEliza.git", from: "1.0.0") ], targets: [ .target(name: "MyEliza", dependencies: [ "Eliza" ]) ] )
The API consists of just three functions:
elizaHi() -> String
elizaBye() -> String
replyTo(_: String) -> String
Example:
let eliza = Eliza() print(eliza.elizaHi()) print(eliza.replyTo("Hi Eliza, I'm feeling super-bad today!")) print(eliza.elizaBye())
It is recommended that you add proper delays when responding to interactive questions. See the iOS app or the therapist tool for an example.
SwiftEliza
Note: This is the ARI fork of kennysong/SwiftEliza. Upstream doesn’t seem to incorporate PRs.
SwiftEliza is a Swift + iOS implementation of Weizenbaum’s ELIZA chatbot, which is a simulation of a Rogerian psychotherapist.
Based on kennysong’s Go implementation and QuestionBot from Apple’s App Development with Swift book.
Notes
To run, just open the
SwiftEliza.xcodeprojin XCode.The functionality of ELIZA is contained in the
Eliza.swiftfile, and the rest are boilerplate for the iOS app.Written in Swift 3 for iOS 10 and above.
Swift Package Manager
Import Package
You can import Eliza as a regular Swift Package Manager package. To do so, use a
Package.swiftlike this:API
The API consists of just three functions:
elizaHi() -> StringelizaBye() -> StringreplyTo(_: String) -> StringExample:
It is recommended that you add proper delays when responding to interactive questions. See the iOS app or the therapist tool for an example.