write备份
//
// Write.swift
// 可读
//
// Created by dengxinkaiacca@163.com on 2022/9/23.
//
import SwiftUI
import NaturalLanguage
import CoreML
import CoreData
import Vision
import Foundation
struct Write: View {
@State var gesjuli = 0.6
var jiazhipre : [String]{
var container = [String]()
var container1 = [String]()
for lie in labelnews.价值列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
for lie in labelnews.去除列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container1.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""}).filter({!container1.contains($0)})
return container
}
var chengzhangpre : [String]{
var container = [String]()
var container1 = [String]()
for lie in labelnews.成长列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
for lie in labelnews.去除列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container1.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""}).filter({!container1.contains($0)})
return container
}
var fapre : [String]{
var container = [String]()
for lie in labelnews.法列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""})
return container
}
var fengxianpre : [String]{
var container = [String]()
var container1 = [String]()
for lie in labelnews.险列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
for lie in labelnews.去除列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container1.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""}).filter({!container1.contains($0)})
return container
}
var kuaijipre : [String]{
var container = [String]()
var container1 = [String]()
for lie in labelnews.会计列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
for lie in labelnews.去除列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container1.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""}).filter({!container1.contains($0)})
return container
}
var jianglaipre : [String]{
var container = [String]()
var container1 = [String]()
for lie in labelnews.将来列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
for lie in labelnews.去除列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container1.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""}).filter({!container1.contains($0)})
return container
}
var guoqupre : [String]{
var container = [String]()
var container1 = [String]()
for lie in labelnews.过去列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
for lie in labelnews.去除列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container1.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""}).filter({!container1.contains($0)})
return container
}
var yanfapre : [String]{
var container = [String]()
var container1 = [String]()
for lie in labelnews.研发列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
for lie in labelnews.去除列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container1.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""}).filter({!container1.contains($0)})
return container
}
var duanyanpre : [String]{
var container = [String]()
for lie in yuyongnews.断言列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""})
return container
}
var chengnuopre : [String]{
var container = [String]()
for lie in yuyongnews.承诺列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""})
return container
}
var biaodapre : [String]{
var container = [String]()
for lie in yuyongnews.表达列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""})
return container
}
var xuangaopre : [String]{
var container = [String]()
for lie in yuyongnews.宣告列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""})
return container
}
var zhilingpre : [String]{
var container = [String]()
for lie in yuyongnews.指令列表 {
if let range = texts2.range(of: lie,options: .regularExpression) {
container.append(String(texts2[range]))
}
}
container = Array(Set(container)).filter({ $0 != ""})
return container
}
@Binding var texts2 : String
@State var writeji = [String]()
let colors = ["竞争", "财报", "语用", "场景"]
let 竞争 = ["成长", "价值", "风险","研发"]
let 语用 = ["承诺", "断言", "宣告","表达","指令"]
let 财报 = ["问题","标注","分词"]
let 标注 = ["选择", "颜色", "大小"]
let 分词 = ["系统分词", "自定义分词","设置"]
let 场景 = ["时态", "合规"]
let 时态 = ["将来", "过去"]
let 合规 = ["会计", "法律"]
@State private var selectedColor = "财报"
@State private var selectedColor1 = "成长"
@State private var selectedColor2 = "承诺"
@State private var selectedColor3 = "问题"
@State private var selectedColor4 = ""
@State private var selectedColor5 = ""
@State private var selectedColor6 = ""
@State private var selectedColor7 = "将来"
@State private var selectedColor8 = "会计"
@State private var selectedColor9 = 1
@State var tabViewSelection = 0
@State var 机器判定类别 = "炒作"
@State var numberOfretries = 3
@Environment(\.colorScheme) var colorScheme: ColorScheme
@State var middleoffset = true
@State var 乐观 = ""
@State var 乐观1 = 0.0
@State var 悲观 = ""
@State var 悲观1 = 0.0
@State var 炒作 = ""
@State var 炒作1 = 0.0
@State var 资金占用 = ""
@State var 资金占用1 = 0.0
@State var 产能过剩 = ""
@State var 产能过剩1 = 0.0
@State var 忽悠增持 = ""
@State var 忽悠增持1 = 0.0
@State var 内控缺陷 = ""
@State var 内控缺陷1 = 0.0
@State var 利益输送 = ""
@State var 利益输送1 = 0.0
@State var 瞒报 = ""
@State var 瞒报1 = 0.0
@State var 流动性风险 = ""
@State var 流动性风险1 = 0.0
@State var 提前确认收入 = ""
@State var 提前确认收入1 = 0.0
@State var 同业竞争 = ""
@State var 同业竞争1 = 0.0
@State var 盈余管理 = ""
@State var 盈余管理1 = 0.0
@State var 项目进展缓慢 = ""
@State var 项目进展缓慢1 = 0.0
@State var 忽悠重组 = ""
@State var 忽悠重组1 = 0.0
@State var 业绩下滑 = ""
@State var 业绩下滑1 = 0.0
@State var 管理层短视 = ""
@State var 管理层短视1 = 0.0
@State var 自利归因 = ""
@State var 自利归因1 = 0.0
@State private var image : UIImage? = nil
@State private var showSheet = false
@State var image1 : UIImage? = nil
@State var 选择照片1 = true
@AppStorage("动词颜色") var dongciColor: Color = Color.purple
@AppStorage("动词大小") var dongcisize: Int = 20
@AppStorage("名词颜色") var mingciColor: Color = Color.purple
@AppStorage("名词大小") var mingcisize: Int = 20
@AppStorage("形容词颜色") var xingrongciColor: Color = Color(red: 228/255, green: 45/255, blue: 68/255).opacity(0.75)
@AppStorage("形容词大小") var xingrongcisize: Int = 18
@AppStorage("介词颜色") var jieciColor: Color = Color.indigo
@AppStorage("介词大小") var jiecisize: Int = 18
@AppStorage("连词颜色") var lianciColor: Color = Color.cyan
@AppStorage("连词大小") var liancisize: Int = 18
@AppStorage("副词颜色") var fuciColor: Color = Color.pink
@AppStorage("副词大小") var fucisize: Int = 18
@AppStorage("代词颜色") var daiciColor: Color = Color.blue
@AppStorage("代词大小") var daicisize: Int = 18
@AppStorage("将来时态颜色") var jiangColor: Color = Color(red: 170/255, green: 171/255, blue: 119/255)
@AppStorage("将来大小") var jiangsize: Int = 18
@AppStorage("过去时态颜色") var guoquColor: Color = Color(red: 177/255, green: 177/255, blue: 177/255)
@AppStorage("过去大小") var guoqusize: Int = 18
@AppStorage("正面颜色") var posColor: Color = Color.red
@AppStorage("正面大小") var possize: Int = 18
@AppStorage("负面颜色") var negColor: Color = Color.blue
@AppStorage("负面大小") var negsize: Int = 18
@AppStorage("礼仪颜色") var liyiColor: Color = Color("礼").opacity(0.55)
@AppStorage("礼仪大小") var liyisize: Int = 10
@AppStorage("经济颜色") var jingjiColor: Color = Color("经济")
@AppStorage("经济大小") var jingjisize: Int = 18
@AppStorage("风险颜色") var fengxianColor: Color = Color.yellow.opacity(0.2)
@AppStorage("风险大小") var fengxiansize: Int = 18
@AppStorage("价值颜色") var jiazhiColor: Color = Color("价值")
@AppStorage("价值大小") var jiazhisize: Int = 18
@AppStorage("成长颜色") var chengzhangColor: Color = Color("成长")
@AppStorage("成长大小") var chengzhangsize: Int = 18
@AppStorage("法规颜色") var faColor: Color = Color("背景1")
@AppStorage("法规大小") var fasize: Int = 18
@Environment(\.managedObjectContext) var managedObjectContext
@FetchRequest(entity: Bagword.entity(),
sortDescriptors: [NSSortDescriptor(key: "name", ascending: true)])
var bagword: FetchedResults<Bagword>
@FetchRequest(entity: Tingyongci.entity(),
sortDescriptors: [NSSortDescriptor(key: "name", ascending: true)])
var tingyongci: FetchedResults<Tingyongci>
@AppStorage("选择词频逆文本") var 词频逆文本 = true
@AppStorage("选择动词") var selectedVerb = true
@AppStorage("选择名词") var selectedNoun = true
@AppStorage("选择介词") var selectedPreposition = true
@AppStorage("选择形容词") var selectedAdjective = false
@AppStorage("选择代词") var selectedPronoun = false
@AppStorage("选择副词") var selectedAdverb = true
@AppStorage("选择连词") var selectedConjunction = true
@AppStorage("选择过去") var selectedGuoqu = false
@AppStorage("选择将来") var selectedJianglai = false
@AppStorage("选择经济") var selectedjingji = false
@AppStorage("选择正面") var selectedpos = false
@AppStorage("选择负面") var selectedneg = false
@AppStorage("选择礼") var selectedli = true
@AppStorage("选择价值") var selectedjiazhi = false
@AppStorage("选择成长") var selectedchengzhang = false
@AppStorage("选择险") var selectedfengxian = true
@AppStorage("选择法") var selectedfa = true
@AppStorage("paixu") private var paixu = true
@AppStorage("paixu1") private var paixu1 = true
@AppStorage("paixu2") private var paixu2 = true
@AppStorage("分词最小字数") var fencislider = 1.0
@AppStorage("自定义输入文本") var shuru3 = ""
@AppStorage("用户输入") var shuru = "我要投资"
{
didSet {
语录输入判定=news.mlmodel_t(text:shuru)
news.tokenizeText(text: texts2, shuru: shuru)
}
}
@AppStorage("总字数") private var zishu_total = 0
@AppStorage("篇章") private var pian_total = 0.0
@AppStorage("语录") var 语录 = "永远不要问理发师你是否需要理发。"
{
didSet{
语录输入判定=news.mlmodel_t(text:语录)
news.tokenizeText(text: texts2, shuru: 语录)
}
}
@AppStorage("网址") private var api="https://hhzjp3y4p6pjfqbkkbhzwgyoqa0ngqep.lambda-url.ap-southeast-1.on.aws/"
@State var juzichuyizishu = Double()
let titles = ["证券代码", "证券简称", "语调","可读性","字数","公告编号","可读"]
let bigFont = UIFont.systemFont(ofSize: 14)
let bigFont1 = UIFont.systemFont(ofSize: 12)
let smallFont = UIFont.systemFont(ofSize: 8)
let modes1 = ["是", "否","均可"]
@State public var heji = [Gonggao]()
@State public var xiazaigonggao = Gonggao(id: 0, zhqdm: "", zhqjc: "", ggbh: "", name: "", riqi: "", mch: "")
@State var pinglun = [String]()
@State var dianzan123 = "0"
@State var dianzan1231 = "0"
@State var isFlagged = false
@State var isFlagged1 = false
@State var shuru1 = ""
@State var name = ""
@State var matches: [Caijing] = []
@State var caijing: NSFetchRequest<Caijing> = Caijing.fetchRequest()
@State private var showingPopover1 = false
@State private var showingPopover2 = false
@State private var showingPopover3 = false
@State private var showingPopover4 = false
@State private var showingPopover5 = true
@State private var showingPopover6 = false
@State private var showingPopover7 = false
@State private var showingPopover8 = false
@State private var showingPopover9 = false
@State private var firstbutton = true
@State var text1 = ""
@State private var showingSheet = false
@State var zhqdm = ""
@State var zhqjc = ""
@State var ggbh = ""
@State var riqi = ""
@State var mch = ""
@State var keduxing = 0.0
@State var yudiao = 0.0
@State var aa = ""
@Binding var selectedmode : String
@Binding var selectedyulu : String
@Binding var zidingyi: Double
@Binding var xitong: Double
@Binding var zishuslider: Double
@Binding var keduxingslider: Double
@Binding var yudiaoslider: Double
@ObservedObject var yuyongnews: 语用数据
@ObservedObject var news: 新闻数据
@ObservedObject var labelnews: 标注数据
@ObservedObject var writenews: 书写数据
@State var isLoading = false
@State private var zishowingSheet = false
@State var keys = [String]()
@State var values = [Double]()
@State var tfidfkeys = [String]()
@State var tfidfvalues = [Double]()
@State var zi_tfidfkeys = [String]()
@State var zi_tfidfvalues = [Double]()
@State var values2 = [Double]()
@State var zi_values2 = [Double]()
@State var zi_keys = [String]()
@State var zi_values = [Double]()
@State var zi: [String] = []
@State var isPerformingTask = false
@State var isPerformingTask2 = false
@State var 识别结果=""
@State var apilist = ["https://hhzjp3y4p6pjfqbkkbhzwgyoqa0ngqep.lambda-url.ap-southeast-1.on.aws/",
"https://2efw7yzcxgdsbobntpxetl5phm0nolob.lambda-url.ap-southeast-1.on.aws/",
"https://rgqalhxxrbfc7l75xyowue4o3q0bdtgd.lambda-url.ap-southeast-1.on.aws/",
"https://okb4vohu2a6alfqbvzrzhmvs6y0culfs.lambda-url.ap-southeast-1.on.aws/",
"https://wsm3dvauy4niozkr2m7zpyrekq0xpjwf.lambda-url.ap-southeast-1.on.aws/",
"https://m6gj4e2ob7nq743kkv2hl467pq0wbbkg.lambda-url.ap-southeast-1.on.aws/"
]
@State var 语录输入判定="??"
@State var zishu = Int()
@State private var rating = 0
@State var juzi = Int()
@State var adv = Double()
@State var meijuadv = Double()
let base = -3.0
let base1 = -0.00001
var verb: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = dongciColor
container.font = .systemFont(ofSize: CGFloat(dongcisize))
return container
}
var adjective: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = xingrongciColor
container.font = .systemFont(ofSize: CGFloat(xingrongcisize))
return container
}
var noun: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = mingciColor
container.font = .systemFont(ofSize: CGFloat(mingcisize))
return container
}
var preposition: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = jieciColor
container.font = .systemFont(ofSize: CGFloat(jiecisize))
return container
}
var conjunction: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = lianciColor
container.font = .systemFont(ofSize: CGFloat(liancisize))
return container
}
var adverb: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = fuciColor
container.font = .systemFont(ofSize: CGFloat(fucisize))
return container
}
var pronoun: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = daiciColor
container.font = .systemFont(ofSize: CGFloat(daicisize))
return container
}
var 过去: AttributeContainer {
var container = AttributeContainer()
container.backgroundColor = guoquColor
container.font = .systemFont(ofSize: CGFloat(guoqusize))
return container
}
var 将来: AttributeContainer {
var container = AttributeContainer()
container.backgroundColor = jiangColor
container.font = .systemFont(ofSize: CGFloat(jiangsize))
return container
}
var positive: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = posColor
container.font = .systemFont(ofSize: CGFloat(possize))
return container
}
var negative: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = negColor
container.font = .systemFont(ofSize: CGFloat(negsize))
return container
}
var 礼: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = liyiColor
container.font = .systemFont(ofSize: CGFloat(liyisize))
return container
}
var 经济: AttributeContainer {
var container = AttributeContainer()
container.backgroundColor = jingjiColor
container.font = .systemFont(ofSize: CGFloat(jingjisize))
return container
}
var 险: AttributeContainer {
var container = AttributeContainer()
container.backgroundColor = fengxianColor
container.font = .systemFont(ofSize: CGFloat(fengxiansize))
return container
}
var 价值: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = jiazhiColor
container.font = .systemFont(ofSize: CGFloat(jiazhisize))
return container
}
var 成长: AttributeContainer {
var container = AttributeContainer()
container.foregroundColor = chengzhangColor
container.font = .systemFont(ofSize: CGFloat(chengzhangsize))
return container
}
var 法: AttributeContainer {
var container = AttributeContainer()
container.backgroundColor = faColor
container.font = .systemFont(ofSize: CGFloat(fasize))
return container
}
@State private var 选择照片 = false
var body: some View {
let attext: AttributedString = {
do {
var text = try AttributedString(markdown: texts2)
if selectedVerb{
let Verb = news.tag(text: texts2).filter { $0.value == "Verb" }
for lie in Verb.keys {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(verb)
}
}
}
if selectedNoun{
let Noun = news.tag(text: texts2).filter { $0.value == "Noun" }
for lie in Noun.keys {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(noun)
}
}}
if selectedPreposition {
let Preposition = news.tag(text: texts2).filter { $0.value == "Preposition" }
for lie in Preposition.keys {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(preposition)
}
}}
if selectedAdjective {
let Adjective = news.tag(text: texts2).filter { $0.value == "Adjective" }
for lie in Adjective.keys {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(adjective)
}
}}
if selectedPronoun {
let Pronoun = news.tag(text: texts2).filter { $0.value == "Pronoun" }
for lie in Pronoun.keys {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(pronoun)
}
}}
if selectedAdverb {
let Adverb = news.tag(text: texts2).filter { $0.value == "Adverb" }
for lie in Adverb.keys {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(adverb)
}
}}
if selectedConjunction {
let Conjunction = news.tag(text: texts2).filter { $0.value == "Conjunction" }
for lie in Conjunction.keys {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(conjunction)
}
}}
if selectedjingji {
for lie in labelnews.经济列表 {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(经济)
}
}}
if selectedpos {
for lie in pos{
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(positive)
}
}
}
if selectedneg {
for lie in neg{
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(negative)
}
}
}
if selectedli {
for lie in labelnews.礼列表 {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(礼)
}
}}
if selectedjiazhi {
for lie in labelnews.价值列表 {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(价值)
}
}}
if selectedchengzhang {
for lie in labelnews.成长列表 {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(成长)
}
}}
if selectedfengxian {
for lie in labelnews.险列表 {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(险)
}
}}
if selectedfa {
for lie in labelnews.法列表 {
if let range = text.range(of: lie,options: .regularExpression) {
text[range].mergeAttributes(法)
}
}}
return text
} catch {
return "暂时未连接上"}}()
ScrollView{
VStack{
if writeji != [] || texts2 != ""{
TabView(selection: $selectedColor9) {
if writeji != []{
List(writeji, id: \.self) {xiazaigonggao in
Text(xiazaigonggao)
.font(.system(size: 14.0))
.fontWeight(.medium)
.lineLimit(nil)
.onTapGesture(perform: {
if self.texts2 == "输入财报内容"{
self.texts2 = ""
self.texts2 += xiazaigonggao
}
else{
self.texts2 += xiazaigonggao
}
selectedColor9 = 1
UIApplication.shared.endEditing()
}
)
}
.listStyle(PlainListStyle())
.tabItem {
Text("目录").padding()
}
.tag(0)
}
if image1 != nil || texts2 != ""{
ZStack(alignment:.topTrailing){
ZStack(alignment:.bottom){
ScrollView
{
if image1 != nil {
Image(uiImage: self.image1!)
.resizable()
.aspectRatio(contentMode: .fill)
}
else{
Text(attext).frame(width:UIScreen.main.bounds.width*0.9)
.lineSpacing(8)
.textSelection(.enabled)
}
}
HStack{
Text("难度:\(keduxing, specifier: "%.1f")").font(.system(size: 12))
.foregroundStyle(keduxing > 1.2 ?
LinearGradient(
colors: [.yellow,.purple],
startPoint: .leading,
endPoint: .trailing
)
:
LinearGradient(
colors: [.green, .blue],
startPoint: .leading,
endPoint: .trailing
)
)
.textSelection(.enabled)
switch keduxing {
case 3...:
Image("含蓄的笑")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
case 1.2...3:
Image("犯傻")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
case 0.0001...1.2:
Image("简单")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
case base...base1:
Image("很简单")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
case ...base:
Image("超级简单")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
default:
Image("简单")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
}
Text("语调:\(yudiao, specifier: "%.1f")").font(.system(size: 12))
.foregroundStyle(yudiao > 0 ?
LinearGradient(
colors: [.yellow,.purple],
startPoint: .leading,
endPoint: .trailing
)
:
LinearGradient(
colors: [.green, .blue],
startPoint: .leading,
endPoint: .trailing
)
)
.textSelection(.enabled)
switch yudiao {
case 3...:
Image("增长")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
case 0.0001...3:
Image("自信")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
case base...base1:
Image("笑哭")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
case ...base:
Image("犯傻")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
default:
Image("自信")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
}
Text("字数:\(zishu)")
.textSelection(.enabled)
.font(.system(size: 12)).foregroundColor(zishu > 3000 ? .red.opacity(0.75): .blue.opacity(0.75))
}.padding(EdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(.gray.opacity(0.3), lineWidth: 1))
}
Menu {
Button(action: {
选择照片1 = false
selectedColor9 = 1
选择照片 = true }, label: {
HStack{
Image(systemName: "camera")
Text("拍照")
}
})
Button(action: {
选择照片1 = true
selectedColor9 = 1
选择照片 = true }, label: {
HStack{
Image(systemName: "photo")
Text("照片")
}})
Button(action: {
if image1 != nil {
self.texts2 = processImage(image: self.image1!)
self.image1 = nil
self.zhqdm = ""
self.zhqjc = ""
self.ggbh = ""
self.riqi = ""
self.mch = ""
self.zishu = self.texts2.count
self.juzi = news.juzi(text: self.texts2)
self.juzichuyizishu = Double(self.zishu / self.juzi)
let conj = news.tag(text: texts2).filter { $0.value == "Conjunction" }.count
let adv = news.tag(text: texts2).filter { $0.value == "Adverb" }.count
self.keduxing = juzichuyizishu/100 + Double(conj)/(Double(zishu)/Double(juzichuyizishu)) + Double(adv) / (Double(zishu)/Double(juzichuyizishu))
self.yudiao = ((news.sentipos(text: texts2)-news.sentineg(text: texts2))/(news.sentipos(text: texts2)+news.sentineg(text: texts2)) - 0.3 ) * 10
self.pinglun = [String]()
}
}) {
Text("确认").font(.system(size: 14))
}.disabled(image1 == nil)
} label: {
Image(systemName: "plus.viewfinder")
.font(.system(size: 18))
}.sheet(isPresented: $选择照片) {
if 选择照片1{
ImagePicker(sourceType: .photoLibrary, selectedImage: self.$image1)
}
else{
ImagePicker(sourceType: .camera, selectedImage: self.$image1)
}
}
.padding(EdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(.gray.opacity(0.3), lineWidth: 1))
.padding(EdgeInsets(top: 30, leading: 0, bottom: 0, trailing: 20))
}
.tabItem {
Text("内容").padding()
}
.tag(1)
}
}.tabViewStyle(PageTabViewStyle()).frame(height:UIScreen.main.bounds.height * 0.35).padding()
}
Divider()
ZStack(alignment:.bottom){
ZStack(alignment:.bottomTrailing){
TextEditor(text: $texts2).padding() .frame(height:UIScreen.main.bounds.height * 0.5)
Button(action: {
UIApplication.shared.endEditing()
text1 = texts2
self.zishu = self.texts2.count
self.juzi = news.juzi(text: self.texts2)
self.juzichuyizishu = Double(self.zishu / self.juzi)
let conj = news.tag(text: texts2).filter { $0.value == "Conjunction" }.count
let adv = news.tag(text: texts2).filter { $0.value == "Adverb" }.count
self.keduxing = juzichuyizishu/100 + Double(conj)/(Double(zishu)/Double(juzichuyizishu)) + Double(adv) / (Double(zishu)/Double(juzichuyizishu))
self.yudiao = ((news.sentipos(text: texts2)-news.sentineg(text: texts2))/(news.sentipos(text: texts2)+news.sentineg(text: texts2)) - 0.3 ) * 10
zi = []
for aRate in bagword {
zi.append(aRate.name ?? "")}
news.fenci1()
for aRate in tingyongci {
news.aa.append(aRate.name ?? "")}
let fencicus1 = fencicus.filter { !news.aa.contains($0) }
let zi_bagOfWords1 = news.zigonggaokey(text: &text1, mubiao: fencicus1, zishu: fencislider)
news.aa += fencicus
var bagOfWords = news.gonggaokey(text: texts2, zishu: fencislider)
let totalcip = bagOfWords.map {$0.value}.reduce(0, +)
text1 = texts2
let zi_bagOfWords = news.zigonggaokey(text: &text1, mubiao: zi,zishu: 1.0)
zi_bagOfWords1.forEach {bagOfWords[$0.key] = $0.value}
let 筛选后字典 = bagOfWords.sorted{ $0.1 > $1.1 }.filter { $0.1 >= xitong }
keys = 筛选后字典.map{$0.key}
values = 筛选后字典.map {$0.value}
let values1 = values.map{$0 / totalcip}
let fetchRequest: NSFetchRequest<Caijing> = Caijing.fetchRequest()
fetchRequest.entity = Caijing.entity()
fetchRequest.resultType = .countResultType
let valuescoretotal = try! managedObjectContext.count(for: fetchRequest)
values2 = keys.map{
fetchRequest.predicate = NSPredicate(
format: "name contains %@",$0
)
let valuescoretotal1 = try! managedObjectContext.count(for: fetchRequest)
let valuescoretotal3 = Double(valuescoretotal)/Double(valuescoretotal1+1)
let valuescoretotal2 = log(valuescoretotal3)
return Double(valuescoretotal2)
}
let values4 = zip(values2, values1).map(*)
let tfidf = Dictionary(uniqueKeysWithValues: zip(keys, values4))
let tfidf1 = tfidf.sorted{ $0.1 > $1.1 }
tfidfkeys = tfidf1.map{$0.key}
tfidfvalues = tfidf1.map {$0.value}
let zi_筛选后字典 = zi_bagOfWords.sorted{ $0.1 > $1.1 }.filter { $0.1 >= zidingyi }
zi_keys = zi_筛选后字典.map{$0.key}
zi_values = zi_筛选后字典.map {$0.value}
let zi_values1 = zi_values.map{$0 / totalcip}
zi_values2 = zi_keys.map{
fetchRequest.predicate = NSPredicate(
format: "name contains %@",$0
)
let valuescoretotal1 = try! managedObjectContext.count(for: fetchRequest)
let valuescoretotal3 = Double(valuescoretotal)/Double(valuescoretotal1)
let valuescoretotal2 = log(valuescoretotal3)
return Double(valuescoretotal2)
}
let zi_values4 = zip(zi_values2, zi_values1).map(*)
let zi_tfidf = Dictionary(uniqueKeysWithValues: zip(zi_keys, zi_values4))
let zi_tfidf1 = zi_tfidf.sorted{ $0.1 > $1.1 }
zi_tfidfkeys = zi_tfidf1.map{$0.key}
zi_tfidfvalues = zi_tfidf1.map {$0.value}
firstbutton = false
showingPopover6 = false
isPerformingTask = false
isPerformingTask2 = false
isLoading = false
Task{
(self.炒作,self.炒作1)=news.炒作(text:self.texts2)
(self.资金占用,self.资金占用1)=news.大股东资金占用(text: self.texts2)
(self.产能过剩,self.产能过剩1)=news.产能过剩风险(text: self.texts2)
(self.忽悠增持,self.忽悠增持1)=news.忽悠增持(text: self.texts2)
(self.内控缺陷,self.内控缺陷1)=news.内控缺陷(text: self.texts2)
(self.同业竞争,self.同业竞争1)=news.同业竞争(text: self.texts2)
(self.利益输送,self.利益输送1)=news.利益输送(text: self.texts2)
(self.盈余管理,self.盈余管理1)=news.盈余管理(text: self.texts2)
(self.忽悠重组,self.忽悠重组1)=news.忽悠重组(text: self.texts2)
(self.流动性风险,self.流动性风险1)=news.流动性风险(text: self.texts2)
(self.项目进展缓慢,self.项目进展缓慢1)=news.项目进展缓慢(text: self.texts2)
(self.瞒报,self.瞒报1)=news.瞒报(text: self.texts2)
(self.提前确认收入,self.提前确认收入1)=news.提前确认收入(text: self.texts2)
(self.业绩下滑,self.业绩下滑1)=news.业绩下滑(text: self.texts2)
(self.管理层短视,self.管理层短视1)=news.管理层短视(text: self.texts2)
(self.乐观,self.乐观1)=news.乐观(text: self.texts2)
(self.悲观,self.悲观1)=news.悲观(text: self.texts2)
(self.自利归因,self.自利归因1)=news.自利归因(text: self.texts2)
}
}) {
Label("完成", systemImage: "rectangle.and.pencil.and.ellipsis")
}.disabled(texts2 == "")
.symbolRenderingMode(.palette)
.symbolRenderingMode(.hierarchical)
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(.teal))
.foregroundColor(.teal)
.padding(EdgeInsets(top: 0, leading: 0, bottom: 10, trailing: 5))
}
VStack{
HStack{
Group{
Menu("利益相关方") {
Menu("监事会") {
Button(action: {
self.writeji = writenews.利益相关方_监事会_募集资金
selectedColor9 = 0
}) {
Text("募集资金")
}
}
Menu("独立董事") {
Button(action: {
self.writeji = writenews.利益相关方_独立董事_募集资金
selectedColor9 = 0
}) {
Text("募集资金")
}
}
}
Menu("基本信息") {
Button(action: {
self.writeji = writenews.基本信息_登记
selectedColor9 = 0
}) {
Text("登记")
}
}
Menu("财务状况") {
Menu("财务状况") {
Button(action: {
self.writeji = writenews.财务状况
self.middleoffset = true
}) {
Text("财务")
}
}.frame(width:100)
}
Menu("审议") {
Menu("管理") {
Button(action: {
self.writeji = writenews.审议_管理_人事
selectedColor9 = 0
}) {
Text("人事")
}
}.frame(width:80)
}
}.padding(EdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(.gray.opacity(0.3), lineWidth: 1))
}
HStack{
Group{
Menu("市场操作") {
Menu("发行") {
Button(action: {
self.writeji = writenews.市场操作_发行_短期融资券
selectedColor9 = 0
}) {
Text("短期融资券")
}
}.frame(width:80)
Menu("股份") {
Button(action: {
self.writeji = writenews.市场操作_股份_增持
selectedColor9 = 0
}) {
Text("增持")
}
Button(action: {
self.writeji = writenews.市场操作_股份_回购
selectedColor9 = 0
}) {
Text("回购")
}
Button(action: {
self.writeji = writenews.市场操作_股份_减持
selectedColor9 = 0
}) {
Text("减持")
}
Button(action: {
self.writeji = writenews.市场操作_投资_减资
selectedColor9 = 0
}) {
Text("减资")
}
}
Menu("投资") {
Menu("基金") {
Button(action: {
self.writeji = writenews.市场操作_投资_基金_基金设立
selectedColor9 = 0
}) {
Text("基金设立")
}
}.frame(width:100)
Menu("项目") {
Button(action: {
self.writeji = writenews.市场操作_投资_项目_必要性
selectedColor9 = 0
}) {
Text("项目必要性")
}
Button(action: {
self.writeji = writenews.市场操作_投资_项目_可行性
selectedColor9 = 0
}) {
Text("项目可行性")
}
}.frame(width:80)
Button(action: {
self.writeji = writenews.市场操作_投资_合资
selectedColor9 = 0
}) {
Text("合资")
}
Button(action: {
self.writeji = writenews.市场操作_投资_减资
selectedColor9 = 0
}) {
Text("减资")
}
}.frame(width:80)
Menu("股权激励") {
Button(action: {
self.writeji = writenews.市场操作_股权激励_发起
selectedColor9 = 0
}) {
Text("发起")
}
Button(action: {
self.writeji = writenews.市场操作_股权激励_考核
selectedColor9 = 0
}) {
Text("考核")
}
}
Menu("现金管理") {
Button(action: {
self.writeji = writenews.现金管理_发起
selectedColor9 = 0
}) {
Text("发起")
}
Button(action: {
self.writeji = writenews.现金管理_风险控制
selectedColor9 = 0
}) {
Text("风控")
}
Menu("品种") {
Button(action: {
self.writeji = writenews.现金管理_品种_委托理财
selectedColor9 = 0
}) {
Text("委托理财")
}
Button(action: {
self.writeji = writenews.现金管理_风险控制
selectedColor9 = 0
}) {
Text("风控")
}
}
}
Menu("担保") {
Button(action: {
self.writeji = writenews.市场操作_担保_被担保方
selectedColor9 = 0
}) {
Text("被担保方")
}
Button(action: {
self.writeji = writenews.市场操作_担保_继续担保
selectedColor9 = 0
}) {
Text("继续担保")
}
}.frame(width:80)
}
Menu("会计准则") {
Button(action: {
self.writeji = writenews.会计准则_政府补助
selectedColor9 = 0
}) {
Text("补助")
}
}
Menu("管理") {
Menu("员工持股计划") {
Button(action: {
self.writeji = writenews.管理_员工持股计划_目的
selectedColor9 = 0
}) {
Text("目的")
}}
Menu("人事") {
Button(action: {
self.writeji = writenews.管理_人事_简历
selectedColor9 = 0
}) {
Text("简历")
}
Menu("任免") {
Menu("监事") {
Button(action: {
self.writeji = writenews.管理_人事_任免_监事_审议
selectedColor9 = 0
}) {
Text("审议")
}
Button(action: {
self.writeji = writenews.管理_人事_任免_监事_原因
selectedColor9 = 0
}) {
Text("原因")
}
}.frame(width:80)
}
Button(action: {
self.writeji = writenews.市场操作_发行_短期融资券
selectedColor9 = 0
}) {
Text("短期融资券")
}
}
Menu("现金") {
Button(action: {
self.writeji = writenews.现金管理_发起
selectedColor9 = 0
}) {
Text("发起")
}
Button(action: {
self.writeji = writenews.现金管理_风险控制
selectedColor9 = 0
}) {
Text("风控")
}
}.frame(width:80)
}
Menu("风险") {
Button(action: {
self.writeji = writenews.风险_研发
selectedColor9 = 0
}) {
Text("研发")
}
Button(action: {
self.writeji = writenews.风险_手续
selectedColor9 = 0
}) {
Text("手续")
}
Button(action: {
self.writeji = writenews.风险_市场
selectedColor9 = 0
}) {
Text("市场")
}
Button(action: {
self.writeji = writenews.风险_回购
selectedColor9 = 0
}) {
Text("回购")
}
}
}
.padding(EdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(.gray.opacity(0.3), lineWidth: 1))
}
HStack{
Group{
Menu("时间安排") {
Button(action: {
self.writeji = writenews.时间安排
selectedColor9 = 0
}) {
Text("时间")
}
}
Menu("影响") {
Menu("管理") {
Button(action: {
self.writeji = writenews.影响_管理_人事
selectedColor9 = 0
}) {
Text("人事")
}
}
Menu("研发") {
Button(action: {
self.writeji = writenews.影响_研发_专利
selectedColor9 = 0
}) {
Text("专利")
}
}
Menu("市场操作") {
Button(action: {
self.writeji = writenews.影响_市场操作_增资
selectedColor9 = 0
}) {
Text("增资")
}
Button(action: {
self.writeji = writenews.影响_市场操作_质押
selectedColor9 = 0
}) {
Text("质押")
}
Button(action: {
self.writeji = writenews.影响_市场操作_募集资金
selectedColor9 = 0
}) {
Text("募集资金")
}
Button(action: {
self.writeji = writenews.影响_市场操作_股份冻结
selectedColor9 = 0
}) {
Text("股份冻结")
}
}
Button(action: {
self.writeji = writenews.影响_政府_补助
selectedColor9 = 0
}) {
Text("补助")
}
}
Menu("协议") {
Button(action: {
self.writeji = writenews.协议_担保
selectedColor9 = 0
}) {
Text("担保")
}
}
}.padding(EdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(.gray.opacity(0.3), lineWidth: 1))
}
}.padding(EdgeInsets(top: 0, leading: 0, bottom: 10, trailing: 0))
}
.padding(.bottom,30)
Divider()
VStack{
VStack {
Picker("Please choose a color", selection: $selectedColor) {
ForEach(colors, id: \.self) {
Text($0)
}
}.pickerStyle(SegmentedPickerStyle())
if selectedColor == "场景" {Picker("Please choose a color", selection: $selectedColor6) {
ForEach(场景, id: \.self) {
Text($0)
}
}.pickerStyle(SegmentedPickerStyle())}
if selectedColor == "财报" {Picker("Please choose a color", selection: $selectedColor3) {
ForEach(财报, id: \.self) {
Text($0)
}
}.pickerStyle(SegmentedPickerStyle())}
}
.background(colorScheme == .light ? Color.white : Color.black)
Group{
if selectedColor == "财报" && selectedColor3 == "问题"{
VStack(alignment:.center){
HStack(alignment:.center){
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("瞒报").font(Font(bigFont1)).foregroundColor(self.瞒报 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.瞒报 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 瞒报1 > 0.8{ Text("\(瞒报1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("大股东资金占用").font(Font(bigFont1)).foregroundColor(self.资金占用 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.资金占用 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 资金占用1 > 0.8{ Text("\(资金占用1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("利益输送").font(Font(bigFont1)).foregroundColor(self.利益输送 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.利益输送 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 利益输送1 > 0.8{ Text("\(利益输送1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("盈余管理").font(Font(bigFont1)).foregroundColor(self.盈余管理 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.盈余管理 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 盈余管理1 > 0.8{ Text("\(盈余管理1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
}
HStack(alignment:.center){
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("同业竞争").font(Font(bigFont1)).foregroundColor(self.同业竞争 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.同业竞争 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 同业竞争1 > 0.8{ Text("\(同业竞争1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("产能过剩").font(Font(bigFont1)).foregroundColor(self.产能过剩 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.产能过剩 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 产能过剩1 > 0.8{ Text("\(产能过剩1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("忽悠增持").font(Font(bigFont1)).foregroundColor(self.忽悠增持 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.忽悠增持 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 忽悠增持1 > 0.8{ Text("\(忽悠增持1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("内控缺陷").font(Font(bigFont1)).foregroundColor(self.内控缺陷 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.内控缺陷 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 内控缺陷1 > 0.8{ Text("\(内控缺陷1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
}
HStack(alignment:.center){
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("炒作")
.font(Font(bigFont1)).foregroundColor(self.炒作 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.炒作 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 炒作1 > 0.8{ Text("\(炒作1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("流动性风险").font(Font(bigFont1)).foregroundColor(self.流动性风险 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.流动性风险 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 流动性风险1 > 0.8{ Text("\(流动性风险1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("忽悠重组").font(Font(bigFont1)).foregroundColor(self.忽悠重组 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.忽悠重组 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 忽悠重组1 > 0.8{ Text("\(忽悠重组1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("项目进展缓慢").font(Font(bigFont1)).foregroundColor(self.项目进展缓慢 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.项目进展缓慢 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 项目进展缓慢1 > 0.8{ Text("\(项目进展缓慢1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
}
HStack(alignment:.center){
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("提前确认收入").font(Font(bigFont1)).foregroundColor(self.提前确认收入 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.提前确认收入 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 提前确认收入1 > 0.8{ Text("\(提前确认收入1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("业绩下滑").font(Font(bigFont1)).foregroundColor(self.业绩下滑 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.业绩下滑 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 业绩下滑1 > 0.8{ Text("\(业绩下滑1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("短视").font(Font(bigFont1)).foregroundColor(self.管理层短视 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.管理层短视 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 管理层短视1 > 0.8{ Text("\(管理层短视1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("自利归因").font(Font(bigFont1)).foregroundColor(self.自利归因 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.自利归因 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 自利归因1 > 0.8{ Text("\(自利归因1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
}
HStack(alignment:.center){
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("乐观").font(Font(bigFont1)).foregroundColor(self.乐观 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.乐观 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 乐观1 > 0.8{ Text("\(乐观1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text("悲观").font(Font(bigFont1)).foregroundColor(self.悲观 == "yes" ? .red : .gray.opacity(0.3))
.padding(EdgeInsets(top: 0, leading: 2, bottom: 2, trailing: 2))
.background(
.ultraThickMaterial,
in: RoundedRectangle(cornerRadius: 2, style: .continuous)
)
.cornerRadius(8)
.overlay(RoundedRectangle(cornerRadius: 6)
.stroke(self.悲观 == "yes" ? .red : .gray.opacity(0.3), lineWidth: 1))
if 悲观1 > 0.8{ Text("\(悲观1,specifier: "%.2f")").foregroundColor(.red).baselineOffset((bigFont1.capHeight - smallFont.capHeight)).font(Font(smallFont))}
}
}
}
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
}.padding(EdgeInsets(top: 4, leading: 4, bottom: 4, trailing: 4))
Group{
if selectedColor == "财报" && selectedColor3 == "标注" {
TabView(selection: $selectedColor4) {
HStack(alignment: .center, spacing: 10){
VStack{
Group{
Button(action: {selectedVerb.toggle()}) {
Label("动", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedVerb ? dongciColor : .gray.opacity(0.3))
Button(action: {selectedNoun.toggle()}) {
Label("名", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedNoun ? mingciColor : .gray.opacity(0.3))
Button(action: {selectedAdjective.toggle()}) {
Label("形", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedAdjective ? xingrongciColor: .gray.opacity(0.3))
Button(action: {selectedPronoun.toggle()}) {
Label("代", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedPronoun ? daiciColor : .gray.opacity(0.3))
Button(action: {selectedAdverb.toggle()}) {
Label("副", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedAdverb ?fuciColor : .gray.opacity(0.3))
}.padding(EdgeInsets(top: 4, leading: 4, bottom: 4, trailing: 4))
}
VStack{
Group{
Button(action: {selectedPreposition.toggle()}) {
Label("介", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedPreposition ?jieciColor : .gray.opacity(0.3))
Button(action: {selectedConjunction.toggle()}) {
Label("连", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedConjunction ?lianciColor: .gray.opacity(0.3))
Button(action: {selectedJianglai.toggle()}) {
Label("将", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.background(selectedJianglai ?jiangColor: .gray.opacity(0.3))
Button(action: {selectedGuoqu.toggle()}) {
Label("过", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.background(selectedGuoqu ?guoquColor: .gray.opacity(0.3))
}.padding(EdgeInsets(top: 4, leading: 4, bottom: 4, trailing: 4))
}
VStack{
Group{
Button(action: {selectedli.toggle()}) {
Label("礼", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedli ?liyiColor: .gray.opacity(0.3))
Button(action: {selectedpos.toggle()}) {
Label("正", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedpos ?posColor: .gray.opacity(0.3))
Button(action: {selectedneg.toggle()}) {
Label("负", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedneg ?negColor: .gray.opacity(0.3))
Button(action: {selectedjingji.toggle()}) {
Label("经", systemImage: "eyeglasses").labelStyle(.titleOnly) .background(selectedjingji ?jingjiColor: .white)
}.background(selectedjingji ?jingjiColor: .gray.opacity(0.3))
}.padding(EdgeInsets(top: 4, leading: 4, bottom: 4, trailing: 4))
}
VStack{
Group{
Button(action: {selectedjiazhi.toggle()}) {
Label("值", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedjiazhi ?jiazhiColor : .gray.opacity(0.3))
Button(action: {selectedchengzhang.toggle()}) {
Label("成", systemImage: "eyeglasses").labelStyle(.titleOnly)
}.foregroundColor(selectedchengzhang ?chengzhangColor: .gray.opacity(0.3))
Button(action: {selectedfengxian.toggle()}) {
Label("险", systemImage: "eyeglasses").labelStyle(.titleOnly).background(selectedfengxian ?fengxianColor: .white)
}.background(selectedfengxian ?fengxianColor: .gray.opacity(0.3))
Button(action: {selectedfa.toggle()}) {
Label("法", systemImage: "eyeglasses").labelStyle(.titleOnly) .background(selectedfa ?faColor: .white)
}.background(selectedfa ?faColor: .gray.opacity(0.3))
}.padding(EdgeInsets(top: 4, leading: 4, bottom: 4, trailing: 4))
}
}
.tabItem {
Text("选择").padding()
}
.tag("选择")
ScrollView(.horizontal){
HStack{ VStack{
ColorPicker("动词", selection: $dongciColor)
ColorPicker("名词", selection: $mingciColor)
ColorPicker("形容词", selection: $xingrongciColor)
ColorPicker("代词", selection: $daiciColor)
}
VStack{
ColorPicker("副词", selection: $fuciColor)
ColorPicker("介词", selection: $jieciColor)
ColorPicker("连词", selection: $lianciColor)
ColorPicker("礼仪", selection: $liyiColor)
}
VStack{
ColorPicker("正面", selection: $posColor)
ColorPicker("负面", selection: $negColor)
ColorPicker("价值", selection: $jiazhiColor)
ColorPicker("成长", selection: $chengzhangColor)
}
VStack{
ColorPicker("将来(背景)", selection: $jiangColor)
ColorPicker("过去(背景)", selection: $guoquColor)
ColorPicker("经济(背景)", selection: $jingjiColor)
ColorPicker("风险(背景)", selection: $fengxianColor)
ColorPicker("法(背景)", selection: $faColor)
}
}
}
.tabItem {
Text("颜色").padding()
}
.tag("颜色")
ScrollView(.horizontal){
HStack{
VStack{
Stepper("动词:\(dongcisize) ",value: $dongcisize, in: 1...50, step: 1).frame(height:15)
Stepper("名词:\(mingcisize) ",value: $mingcisize, in: 1...50, step: 1).frame(height:15)
Stepper("代词:\(daicisize) ",value: $daicisize, in: 1...50, step: 1).frame(height:15)
Stepper("形词:\(xingrongcisize) ",value: $xingrongcisize, in: 1...50, step: 1).frame(height:15)
Stepper("副词:\(fucisize) ",value: $fucisize, in: 1...50, step: 1).frame(height:15)
}
VStack{
Stepper("介词:\(jiecisize) ",value: $jiecisize, in: 1...50, step: 1).frame(height:15)
Stepper("连词:\(liancisize) ",value: $liancisize, in: 1...50, step: 1).frame(height:15)
Stepper("将来:\(jiangsize) ",value: $jiangsize, in: 1...50, step: 1).frame(height:15)
Stepper("过去:\(guoqusize) ",value: $guoqusize, in: 1...50, step: 1).frame(height:15)
Stepper("礼用:\(liyisize) ",value: $liyisize, in: 1...50, step: 1).frame(height:15)
}
VStack{
Stepper("正面:\(possize) ",value: $possize, in: 1...50, step: 1).frame(height:15)
Stepper("负面:\(negsize) ",value: $negsize, in: 1...50, step: 1).frame(height:15)
Stepper("经济:\(jingjisize) ",value: $jingjisize, in: 1...50, step: 1).frame(height:15)
Stepper("价值:\(jiazhisize) ",value: $jiazhisize, in: 1...50, step: 1).frame(height:15)
Stepper("成长:\(chengzhangsize) ",value: $chengzhangsize, in: 1...50, step: 1).frame(height:15)
Stepper("风险:\(fengxiansize) ",value: $fengxiansize, in: 1...50, step: 1).frame(height:15)
Stepper("法律:\(fasize) ",value: $fasize, in: 1...50, step: 1).frame(height:15)
}
}
}
.tabItem {
Text("大小").padding()
}
.tag("大小")
}.tabViewStyle(PageTabViewStyle()).indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
}
Group{
if selectedColor == "财报" && selectedColor3 == "分词" {
TabView(selection: $selectedColor5) {
if tfidfkeys != []{
VStack(alignment:.center){
Button(action: {
词频逆文本.toggle()
}, label: {
Text("系统分词").fontWeight(.medium)
.opacity(词频逆文本 ? 1 : 0.6)
.font(.system(size: 12.0))}
)
.frame(width:60)
ScrollViewReader { scrollView in
ScrollView {
List{ForEach(tfidfkeys.indices,id:\.self) {index in
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text(tfidfkeys[index]).font(Font(bigFont)).foregroundColor(index > 2 ?(colorScheme == .light ? .black :.white) : .red).id(index)
if 词频逆文本{
Text("\(tfidfvalues[index],specifier: "%.3f")").baselineOffset((bigFont.capHeight - smallFont.capHeight)).font(Font(smallFont)).foregroundColor(index > 2 ?.secondary : .red)
}
}}
}
.textSelection(.enabled)
.onTapGesture(perform: {
scrollView.scrollTo(1, anchor: .center)
})
.frame(height:UIScreen.main.bounds.height*gesjuli) .listStyle(PlainListStyle())
}
HStack{
Button(action: {
withAnimation {
scrollView.scrollTo(1, anchor: .center)
}
}) {
Image(systemName: "backward.end")
.opacity(keys.count > 6 ? 1 : 0)
.font(.system(size: 16))
.foregroundColor(colorScheme == .light ? .black :.white)
}.padding(.vertical,5)
.disabled(showingPopover6)
Button(action: {
withAnimation {
scrollView.scrollTo(keys.count - 1)
}
}) {
Image(systemName: "forward.end")
.opacity(keys.count > 6 ? 1 : 0)
.font(.system(size: 16))
.foregroundColor(colorScheme == .light ? .black :.white)
}.padding(.vertical,5)
.disabled(showingPopover6)
}
}
}
.tabItem {
Text("系统分词").padding()
}
.tag("系统分词")
}
if zi_tfidfkeys != []{
VStack(alignment:.center){
Button(action: {
词频逆文本.toggle()
}, label: {
Text("自定义分词").fontWeight(.medium)
.opacity(词频逆文本 ? 1 : 0.6)
.font(.system(size: 12.0))}
)
.frame(width:100)
ScrollViewReader { scrollView in
ScrollView {
List{ForEach(zi_tfidfkeys.indices,id:\.self) {index in
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text(zi_tfidfkeys[index]).font(Font(bigFont)).foregroundStyle(
LinearGradient(
colors: [.purple,.pink],
startPoint: .leading,
endPoint: .trailing
)).id(index)
if 词频逆文本{
Text("\(zi_tfidfvalues[index],specifier: "%.3f")").baselineOffset((bigFont.capHeight - smallFont.capHeight)).font(Font(smallFont)).foregroundStyle(
LinearGradient(
colors: [.purple,.pink],
startPoint: .leading,
endPoint: .trailing
))
}
}
}}
.textSelection(.enabled)
.onTapGesture(perform: {
scrollView.scrollTo(1, anchor: .center)
})
.frame(height:UIScreen.main.bounds.height*gesjuli) .listStyle(PlainListStyle())
}
HStack{
Button(action: {
withAnimation {
scrollView.scrollTo(1, anchor: .center)
}
}) {
Image(systemName: "backward.end")
.opacity(zi_keys.count > 5 ? 1 : 0)
.font(.system(size: 16))
.foregroundColor(colorScheme == .light ? .black :.white)
}
Button(action: {
withAnimation {
scrollView.scrollTo(zi_keys.count - 1)
}
}) {
Image(systemName: "forward.end")
.opacity(zi_keys.count > 6 ? 1 : 0)
.font(.system(size: 16))
.foregroundColor(colorScheme == .light ? .black :.white)
}
}
}
}
.tabItem {
Text("自定义分词").padding()
}
.tag("自定义分词")
}
VStack{
VStack{
Stepper("自定义最小词频:\(zidingyi, specifier: "%.0f") ",value: $zidingyi, in: 1...50, step: 1).frame(height:15).accentColor(.teal).padding(.bottom,5)
Stepper("系统最小词频:\(xitong, specifier: "%.0f") ",value: $xitong, in: 1...50, step: 1).frame(height:15).padding(.bottom,5)
Stepper("系统最小字数:\(fencislider, specifier: "%.0f") ",value: $fencislider, in: 1...20, step: 1).frame(height:15).padding(.bottom,5)
}
HStack{
Spacer()
Button(action: {
zishowingSheet.toggle()
}, label: {
VStack{
Image(systemName: "scissors").foregroundColor(colorScheme == .light ? Color.black : Color.white)
Text("自定义分词").foregroundColor(colorScheme == .light ? Color.black : Color.white)
.font(.system(size: 12.0))}
}).sheet(isPresented: $zishowingSheet) {
CustomBag()}
Spacer()
Button(action: {
showingSheet.toggle()
}, label: {
Image("停用词")
.resizable()
.scaledToFit()
.frame(width: 35, height: 35)}
)
.sheet(isPresented: $showingSheet) {
xianshi()}
Spacer()
}
Button(action: {
text1 = texts2
zi = []
for aRate in bagword {
zi.append(aRate.name!)
}
news.fenci1()
for aRate in tingyongci {
news.aa.append(aRate.name!)}
let fencicus1 = fencicus.filter {!news.aa.contains($0)}
let zi_bagOfWords1 = news.zigonggaokey(text: &text1, mubiao: fencicus1,zishu: fencislider)
news.aa += fencicus
var bagOfWords = news.gonggaokey(text: texts2, zishu: fencislider)
text1 = texts2
let zi_bagOfWords = news.zigonggaokey(text: &text1, mubiao: zi,zishu: 1.0)
zi_bagOfWords1.forEach {bagOfWords[$0.key] = $0.value
}
let 筛选后字典 = bagOfWords.sorted{ $0.1 > $1.1 }.filter { $0.1 >= xitong }
keys = 筛选后字典.map{$0.key}
values = 筛选后字典.map {$0.value}
let zi_筛选后字典 = zi_bagOfWords.sorted{ $0.1 > $1.1 }.filter { $0.1 >= zidingyi }
zi_keys = zi_筛选后字典.map{$0.key}
zi_values = zi_筛选后字典.map {$0.value}
}, label: {
HStack(spacing:0){
Image(systemName: "checkmark.shield")
Text("确认")
.font(.system(size: 14.0))}
})
}
.tabItem {
Text("设置").padding()
}
.tag("设置")
}.tabViewStyle(PageTabViewStyle()).indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always)).padding()
.overlay(
RoundedRectangle(cornerRadius: 16)
.stroke(.gray.opacity(0.3), lineWidth: 1)
).padding()
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
}
Group{
if selectedColor == "财报" && selectedColor3 == "匹配" {
VStack{
HStack{
Spacer()
VStack{
Button(action: {
showingPopover1 = true
}, label: {
Text(语录输入判定)
.font(.caption).bold()
.foregroundColor(语录输入判定 == "投机" ? .red.opacity(0.75): .blue.opacity(0.75))
})
.popover(isPresented: $showingPopover1) {
Text("使用训练好的自然语言模型对语录和用户输入进行投资还是投机的判定,仅供参考")
.font(.headline)}
}
Spacer()
}
HStack{
ZStack(alignment: .topLeading){
TextEditor(text: $shuru)
if shuru.isEmpty {
Text("请输入预匹配内容")
.foregroundColor(Color(UIColor.placeholderText))
.padding(15)
}
}
.padding(7)
.padding(.horizontal, 25)
.background(Color(.systemGray6))
.cornerRadius(8)
.overlay(
Image(systemName: "magnifyingglass")
.foregroundColor(.gray)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .topLeading)
)
.shadow(color: .gray, radius: 5, x: 1, y: 1)
.foregroundColor(Color.gray)
.frame(height:100)
Button(action: {
语录输入判定=news.mlmodel_t(text:shuru)
news.tokenizeText(text: texts2, shuru: shuru)
UIApplication.shared.endEditing()
}) {
Image(systemName: "wand.and.rays")
.font(.system(size: 24))
.foregroundColor(.blue)
}
}.padding()
HStack{Text("语录匹配句") .font(.headline).padding(.leading,6)
Image(systemName: "wonsign.circle")
.symbolRenderingMode(.hierarchical)
.foregroundColor(.indigo)
.font(.system(size: 25.0))
Spacer()}
.padding(.leading,5)
ScrollView{
Text(news.显示字典)
.font(.system(size: 15.0))
}.frame(height:100)
.padding()
}
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
}
Group{
if selectedColor == "竞争" && (jiazhipre.count + fengxianpre.count + chengzhangpre.count + yanfapre.count) != 0 {
TabView(selection: $selectedColor1) {
if chengzhangpre.count != 0 {
VStack(alignment:.leading){
Text("成长(\(chengzhangpre.count))").padding()
List{ForEach(chengzhangpre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
}
.tabItem {
Text("成长").padding()
}
.tag("成长")
}
if jiazhipre.count != 0 {
VStack(alignment:.leading){
Text("价值(\(jiazhipre.count))").padding()
List{ForEach(jiazhipre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
}
.tabItem {
Text("价值").padding()
}
.tag("价值")
}
if fengxianpre.count != 0 {
VStack(alignment:.leading){
Text("风险(\(fengxianpre.count))").padding()
List{ForEach(fengxianpre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
}
.tabItem {
Text("风险").padding()
}
.tag("风险")
}
if yanfapre.count != 0 {
VStack(alignment:.leading){
Text("研发(\(yanfapre.count))").padding()
List{ForEach(yanfapre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
}
.tabItem {
Text("研发").padding()
}
.tag("研发")
}
}.tabViewStyle(PageTabViewStyle()).indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
}
ScrollView{
let yuyong = chengnuopre.count + duanyanpre.count + xuangaopre.count + biaodapre.count + zhilingpre.count
if selectedColor == "语用" && yuyong != 0 {
TabView(selection: $selectedColor2) {
if chengnuopre.count != 0 {
VStack(alignment:.leading)
{
Text("承诺(\(chengnuopre.count))").padding()
List{ForEach(chengnuopre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.lineLimit(nil)
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("承诺").padding()
}
.tag("承诺")
}
if duanyanpre.count != 0 {
VStack(alignment:.leading)
{Text("断言(\(duanyanpre.count))").padding()
List{ForEach(duanyanpre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("断言").padding()
}
.tag("断言")
}
if xuangaopre.count != 0 {
VStack(alignment:.leading)
{Text("宣告(\(xuangaopre.count))").padding()
List{ForEach(xuangaopre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("宣告").padding()
}
.tag("宣告")
}
if biaodapre.count != 0 {
VStack(alignment:.leading)
{Text("表达(\(biaodapre.count))").padding()
List{ForEach(biaodapre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("表达").padding()
}
.tag("表达")
}
if zhilingpre.count != 0 {
VStack(alignment:.leading)
{Text("指令(\(zhilingpre.count))").padding()
List{ForEach(zhilingpre,id:\.self) {index in
GroupBox{
Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("指令").padding()
}
.tag("指令")
}
}.tabViewStyle(PageTabViewStyle()).indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
Group{
if selectedColor == "场景" && selectedColor6 == "时态" && (jianglaipre.count + guoqupre.count) != 0 {
TabView(selection: $selectedColor7) {
if jianglaipre.count != 0 {
VStack(alignment:.leading)
{Text("将来(\(jianglaipre.count))").padding()
List{ForEach(jianglaipre,id:\.self) {index in
GroupBox{ Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("将来").padding()
}
.tag("将来")
}
if guoqupre.count != 0 {
VStack(alignment:.leading)
{
Text("过去(\(guoqupre.count))").padding()
List{ForEach(guoqupre,id:\.self) {index in
GroupBox{ Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("过去").padding()
}
.tag("过去")
}
}.tabViewStyle(PageTabViewStyle()).indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
if selectedColor == "场景" && selectedColor6 == "合规" && (kuaijipre.count + fapre.count) != 0 {
TabView(selection: $selectedColor8) {
if kuaijipre.count != 0 {
VStack(alignment:.leading)
{Text("会计(\(kuaijipre.count))").padding()
List{ForEach(kuaijipre,id:\.self) {index in
GroupBox{ Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("会计").padding()
}
.tag("会计")
}
if fapre.count != 0 {
VStack(alignment:.leading)
{
Text("法律(\(fapre.count))").padding()
List{ForEach(fapre,id:\.self) {index in
GroupBox{ Text(index).lineLimit(nil)
.font(.system(size: 12.0))
.textSelection(.enabled)
}
}
}.listStyle(.plain)
Spacer()
}
.tabItem {
Text("法律").padding()
}
.tag("法律")
}
}.tabViewStyle(PageTabViewStyle()).indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
.frame(height:UIScreen.main.bounds.height*gesjuli)
}
}
}
Spacer()
}
.frame(height:UIScreen.main.bounds.height*gesjuli).background(colorScheme == .light ? Color.white : Color.black)
}
}
}
}

浙公网安备 33010602011771号