diff --git a/Package.resolved b/Package.resolved index a06bb9418572e56fc3f47215c083541e831d362a..349cccf202b9353b62d63b1aba3f13b430b3cdb0 100644 --- a/Package.resolved +++ b/Package.resolved @@ -62,15 +62,6 @@ "revision" : "8eeea249ead49f6f8db8e76bf66abce49cc5b856", "version" : "1.0.0" } - }, - { - "identity" : "swiftcsv", - "kind" : "remoteSourceControl", - "location" : "https://github.com/swiftcsv/SwiftCSV.git", - "state" : { - "revision" : "96fa14b92e88e0befdbc8bc31c7c2c9594a30060", - "version" : "0.8.1" - } } ], "version" : 2 diff --git a/Package.swift b/Package.swift index e5c3ed79ab10dac424c7728e84d0434c69b66b40..c49981ed1c766290bbf7d13dd9f988881c818088 100644 --- a/Package.swift +++ b/Package.swift @@ -18,7 +18,7 @@ let package = Package( .package(url: "https://github.com/tsolomko/SWCompression.git", .upToNextMajor(from: "4.8.5")), .package(url: "https://github.com/jbadger3/SwiftAnnoy", .upToNextMajor(from: "1.0.0")), .package(url: "https://github.com/L1MeN9Yu/Elva", .upToNextMajor(from: "2.0.0")), - .package(url: "https://github.com/swiftcsv/SwiftCSV.git", from: "0.8.0"), + //.package(url: "https://github.com/swiftcsv/SwiftCSV.git", from: "0.8.0"), .package(url: "https://github.com/Bersaelor/KDTree", .upToNextMajor(from: "1.4.1")), .package(url: "https://github.com/apple/swift-collections", .upToNextMinor(from: "1.0.0")), //.package(url: "https://github.com/dclelland/Plinth", from: "2.0.0"), @@ -35,7 +35,7 @@ let package = Package( "SWCompression", "SwiftAnnoy", .product(name: "ZSTD", package: "Elva"), - "SwiftCSV", + //"SwiftCSV", "KDTree", .product(name: "Collections", package: "swift-collections"), //"Plinth", diff --git a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus + Text Processing.swift b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus + Text Processing.swift index 9382488ed0cb09651435470fcf4a5ccf94f2fb09..f3b3971da5553556377a66f0f74d48fb79b1f6f1 100644 --- a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus + Text Processing.swift +++ b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus + Text Processing.swift @@ -1,5 +1,27 @@ -import Foundation +// Copyright (c) 2023 Jim Wallace +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +import Foundation extension SNLPCorpus { static func applyBasicTextProcessing(_ text: String, characterFilters: CharacterSet, tokenFilters: Set<String>) -> [String] { diff --git a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus.swift b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus.swift index 1292f81c1789ee77b034628cff00523426a721c1..0f04280eabe969e35f43059201d688d662f28674 100644 --- a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus.swift +++ b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPCorpus.swift @@ -1,5 +1,27 @@ -import Foundation +// Copyright (c) 2023 Jim Wallace +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +import Foundation protocol SNLPCorpus { diff --git a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDataItem.swift b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDataItem.swift index d70aa852b7002e3dd81a63ed444233473c695fa7..b79e6fdc82434717e804eb5372a9d1677b8dfc8a 100644 --- a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDataItem.swift +++ b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDataItem.swift @@ -1,8 +1,26 @@ +// Copyright (c) 2023 Jim Wallace +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. -// What's the most basic, common features we need? -// - A date -// - Some text (maybe a bunch, concatenated?) -// - An ID for the entry ... Identifiable means awkwardness for Mac versioning import Foundation public protocol SNLPDataItem: Codable, Equatable, Identifiable { diff --git a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDictionary.swift b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDictionary.swift index 345247909448c441841e87499f76ef394dd5d20d..fcee4dbe58554389799047639f2bd63a006ae0d6 100644 --- a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDictionary.swift +++ b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPDictionary.swift @@ -1,12 +1,27 @@ +// Copyright (c) 2023 Jim Wallace // -// SNLPDictionary.swift -// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: // -// Created by Jim Wallace on 2023-03-09. +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. // +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. import Foundation -import NaturalLanguage protocol SNLPDictionary : Codable { diff --git a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPTopicModel.swift b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPTopicModel.swift index 792e35be939b3274b991f316f92b681601796325..47ba50b689659fb6bfc2113ac5716b3f5e1d457a 100644 --- a/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPTopicModel.swift +++ b/Sources/SwiftNLP/0. SNLP Internal Protocols/SNLPTopicModel.swift @@ -1,14 +1,29 @@ +// Copyright (c) 2023 Jim Wallace // -// File.swift -// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: // -// Created by Jim Wallace on 2023-04-06. +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. // +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. import Foundation - protocol SNLPTopicModel { associatedtype DocumentEncoding diff --git a/Sources/SwiftNLP/1. Data Collection/CSV/CSVDataItem.swift b/Sources/SwiftNLP/1. Data Collection/CSV/CSVDataItem.swift index cf63f39b1554308e507ca43787d6d5aa0616486d..fe9f418718fc94cbac68e366f88b54cbba7b92a3 100644 --- a/Sources/SwiftNLP/1. Data Collection/CSV/CSVDataItem.swift +++ b/Sources/SwiftNLP/1. Data Collection/CSV/CSVDataItem.swift @@ -1,5 +1,5 @@ import Foundation -import SwiftCSV +//import SwiftCSV public struct CSVDataItem: SNLPDataItem { diff --git a/Sources/SwiftNLP/5. Topic Model/StubTopicModel.swift b/Sources/SwiftNLP/5. Topic Model/StubTopicModel.swift index 664c3abb1d5f1bfc66bf4105879beddef720ad76..30afc387ed8bbbf1a74e5fdb785b19ea2cea68dd 100644 --- a/Sources/SwiftNLP/5. Topic Model/StubTopicModel.swift +++ b/Sources/SwiftNLP/5. Topic Model/StubTopicModel.swift @@ -1,9 +1,25 @@ +// Copyright (c) 2023 Jim Wallace // -// File.swift -// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: // -// Created by Jim Wallace on 2023-04-06. +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. // +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. import Foundation diff --git a/Tests/SwiftNLPTests/Reddit API/Session Network Endpoint Tests.swift b/Tests/SwiftNLPTests/Reddit API/Session Network Endpoint Tests.swift index 38ddf0ea24e040989eacc0c552fd5984b2eeefc2..4b84750fc927755fb18d34b85762ec80bfd2feb1 100644 --- a/Tests/SwiftNLPTests/Reddit API/Session Network Endpoint Tests.swift +++ b/Tests/SwiftNLPTests/Reddit API/Session Network Endpoint Tests.swift @@ -169,16 +169,7 @@ final class RedditSessionEndpointTest: XCTestCase { // This should return an array of listings, one with original submisison and one with responses. // It's a big thread, so we *should* also get a `more` entry let result = try await client.searchComment(subreddit: "AskReddit", articleID: "7dljcy", showMore: true) - -// for (i, listing) in result.enumerated() { -// print("Listing \(i): \(listing.data.children.count) elements") -// for item in listing.data.children { -// if item.kind == .more { -// print(item) -// } -// } -// } - + XCTAssert(result.count > 0) //XCTAssert(result[1].children.count > 0) } diff --git a/Tests/SwiftNLPTests/SwiftAnnoyTest.swift b/Tests/SwiftNLPTests/SwiftAnnoyTest.swift index 8d05a082404bef54facbaa6c96e6674f8964b5ca..534d7bb23369de848d3038dd0eb4d90df8eb2624 100644 --- a/Tests/SwiftNLPTests/SwiftAnnoyTest.swift +++ b/Tests/SwiftNLPTests/SwiftAnnoyTest.swift @@ -30,7 +30,7 @@ final class SwiftAnnoyTest: XCTestCase { //print("Initialized corpus in \(totalTime) seconds") corpus.addDocuments(documents: docs) - print(corpus.encodedDocuments) + //print(corpus.encodedDocuments) let dictionary = corpus.dictionary