From 1e8b1ecbc7478fa7ae0e5eb9ae812909003d51cb Mon Sep 17 00:00:00 2001 From: Jim Wallace <james.wallace@uwaterloo.ca> Date: Thu, 21 Dec 2023 21:57:36 -0500 Subject: [PATCH] Cleaning up for Linux --- Package.resolved | 9 ------- Package.swift | 4 +-- .../SNLPCorpus + Text Processing.swift | 24 ++++++++++++++++- .../SNLPCorpus.swift | 24 ++++++++++++++++- .../SNLPDataItem.swift | 26 ++++++++++++++++--- .../SNLPDictionary.swift | 23 +++++++++++++--- .../SNLPTopicModel.swift | 23 +++++++++++++--- .../1. Data Collection/CSV/CSVDataItem.swift | 2 +- 8 files changed, 109 insertions(+), 26 deletions(-) diff --git a/Package.resolved b/Package.resolved index a06bb941..349cccf2 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 e5c3ed79..c49981ed 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 9382488e..f3b3971d 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 1292f81c..0f04280e 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 d70aa852..b79e6fdc 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 34524790..fcee4dbe 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 792e35be..47ba50b6 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 cf63f39b..fe9f4187 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 { -- GitLab