repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/network/tasks/CreateEndUserTask.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/network/WootricApiCallback.java // public interface WootricApiCallback { // void onAuthenticateSuccess(String accessToken); // void onGetEndUserIdSuccess(long endUserId); // void onEndUserNotFound(); // void onCreateEndUserSuccess(long endUserId);...
import com.wootric.androidsdk.network.WootricApiCallback; import com.wootric.androidsdk.objects.EndUser; import org.json.JSONException; import org.json.JSONObject; import java.util.Map;
/* * Copyright (c) 2016 Wootric (https://wootric.com) * * 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, modi...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/network/WootricApiCallback.java // public interface WootricApiCallback { // void onAuthenticateSuccess(String accessToken); // void onGetEndUserIdSuccess(long endUserId); // void onEndUserNotFound(); // void onCreateEndUserSuccess(long endUserId);...
public CreateEndUserTask(EndUser endUser, String accessToken, String accountToken, WootricApiCallback wootricApiCallback) {
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/views/tablet/ScoreView.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/utils/ScreenUtils.java // public class ScreenUtils { // // private static int screenHeight = 0; // private static int screenWidth = 0; // // public static int getScreenHeight(Context c) { // if (c != null && screenHeight == 0) { // ...
import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import com.wootric.androidsdk.R; import com.wootric.androidsdk.utils.ScreenUtils; import android.content.Context; import android.content.res.Resources; import android.graphics.Typeface; import android.graphics.drawable.Drawabl...
public ScoreView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init() { setGravity(Gravity.CENTER); final Context context = getContext(); final Resources res = context.getResources(); m...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/utils/ScreenUtils.java // public class ScreenUtils { // // private static int screenHeight = 0; // private static int screenWidth = 0; // // public static int getScreenHeight(Context c) { // if (c != null && screenHeight == 0) { // ...
setHeight((int) ScreenUtils.dpToPx(32));
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/views/phone/RatingBar.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/objects/Score.java // public final class Score { // private final int score; // private final String surveyType; // private final int surveyTypeScale; // // private static final HashMap<String, ArrayList<HashMap<String, Integer>>> scoreRules = ne...
import android.view.View; import com.wootric.androidsdk.R; import com.wootric.androidsdk.objects.Score; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Parcel; import android.os.Parcelable; import android.util.Attribu...
private OnScoreChangedListener mOnScoreChangedListener; public RatingBar(Context context) { super(context); init(context); } public RatingBar(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public RatingBar(Context context, Attrib...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/objects/Score.java // public final class Score { // private final int score; // private final String surveyType; // private final int surveyTypeScale; // // private static final HashMap<String, ArrayList<HashMap<String, Integer>>> scoreRules = ne...
Score score = new Score(-1, mSurveyType, mSurveyTypeScale);
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/network/tasks/UpdateEndUserTask.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/network/WootricApiCallback.java // public interface WootricApiCallback { // void onAuthenticateSuccess(String accessToken); // void onGetEndUserIdSuccess(long endUserId); // void onEndUserNotFound(); // void onCreateEndUserSuccess(long endUserId);...
import com.wootric.androidsdk.network.WootricApiCallback; import com.wootric.androidsdk.objects.EndUser; import java.util.Map;
/* * Copyright (c) 2016 Wootric (https://wootric.com) * * 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, modi...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/network/WootricApiCallback.java // public interface WootricApiCallback { // void onAuthenticateSuccess(String accessToken); // void onGetEndUserIdSuccess(long endUserId); // void onEndUserNotFound(); // void onCreateEndUserSuccess(long endUserId);...
public UpdateEndUserTask(EndUser endUser, String accessToken, String accountToken, WootricApiCallback wootricApiCallback) {
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/objects/Settings.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
import org.json.JSONObject; import java.util.Date; import static com.wootric.androidsdk.utils.Utils.isBlank; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import com.wootric.androidsdk.Constants; import com.wootric.androidsdk.R; import org.json.JSONException;
/* * Copyright (c) 2016 Wootric (https://wootric.com) * * 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, modi...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
private int adminPanelTimeDelay = Constants.NOT_SET;
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/objects/Settings.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
import org.json.JSONObject; import java.util.Date; import static com.wootric.androidsdk.utils.Utils.isBlank; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import com.wootric.androidsdk.Constants; import com.wootric.androidsdk.R; import org.json.JSONException;
public String getAnchorLikely() { return localizedTexts.getAnchorLikely(); } public String getAnchorNotLikely() { return localizedTexts.getAnchorNotLikely(); } public String getBtnSubmit() { return localizedTexts.getSubmit().toUpperCase(); } public String getBtnDi...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
if (isBlank(followupQuestion) && adminPanelCustomMessage != null) {
Wootric/WootricSDK-Android
androidsdk/src/test/java/com/wootric/androidsdk/objects/WootricCustomThankYouTest.java
// Path: androidsdk/src/test/java/com/wootric/androidsdk/TestHelper.java // public class TestHelper { // private static final String CLIENT_ID = "testClientId"; // private static final String CLIENT_SECRET = "testClientSecret"; // private static final String ACCOUNT_TOKEN = "testAccountToken"; // public...
import android.os.Parcel; import com.wootric.androidsdk.TestHelper; import org.json.JSONException; import org.json.JSONObject; import org.junit.Test; import java.io.IOException; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock;
assertThat(customThankYou.getLinkTextForScore(4, "CSAT", 0)).isEqualTo("promoter"); assertThat(customThankYou.getLinkTextForScore(5, "CSAT", 0)).isEqualTo("promoter"); } @Test public void returnsCSATDefaultLinkText() throws Exception { WootricCustomThankYou customThankYou = new Woot...
// Path: androidsdk/src/test/java/com/wootric/androidsdk/TestHelper.java // public class TestHelper { // private static final String CLIENT_ID = "testClientId"; // private static final String CLIENT_SECRET = "testClientSecret"; // private static final String ACCOUNT_TOKEN = "testAccountToken"; // public...
TestHelper helper = new TestHelper();
Wootric/WootricSDK-Android
androidsdk/src/test/java/com/wootric/androidsdk/network/tasks/GetRegisteredEventsTaskTest.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/objects/User.java // public class User implements Parcelable { // private String clientId; // private String accountToken; // // public User(User user) { // this.clientId = user.clientId; // this.accountToken = user.accountToken; // ...
import com.wootric.androidsdk.objects.User; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.robolectric.RobolectricTestRunner; import static org.assertj.core.api.Assertions.assertThat;
package com.wootric.androidsdk.network.tasks; @RunWith(RobolectricTestRunner.class) public class GetRegisteredEventsTaskTest { @Mock GetRegisteredEventsTask.Callback surveyCallback; @Test public void testGet_RequestWithEuToken() throws Exception {
// Path: androidsdk/src/main/java/com/wootric/androidsdk/objects/User.java // public class User implements Parcelable { // private String clientId; // private String accountToken; // // public User(User user) { // this.clientId = user.clientId; // this.accountToken = user.accountToken; // ...
User user = new User("NPS-EU");
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/network/tasks/GetRegisteredEventsTask.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
import java.util.ArrayList; import android.util.Log; import com.wootric.androidsdk.Constants; import com.wootric.androidsdk.network.responses.RegisteredEventsResponse; import com.wootric.androidsdk.objects.User; import org.json.JSONArray; import org.json.JSONException;
/* * Copyright (c) 2016 Wootric (https://wootric.com) * * 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, modi...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
Log.d(Constants.TAG, "parameters: " + paramsMap);
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/network/tasks/GetRegisteredEventsTask.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
import java.util.ArrayList; import android.util.Log; import com.wootric.androidsdk.Constants; import com.wootric.androidsdk.network.responses.RegisteredEventsResponse; import com.wootric.androidsdk.objects.User; import org.json.JSONArray; import org.json.JSONException;
@Override protected void buildParams() { paramsMap.put("account_token", user.getAccountToken()); Log.d(Constants.TAG, "parameters: " + paramsMap); } @Override protected String requestUrl() { return getSurveyEndpoint() + REGISTERED_EVENTS_PATH; } @Override pro...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/Constants.java // public class Constants { // // public static final long DAY_IN_MILLIS = 1000L *60L *60L *24L; // // public static final int NOT_SET = -1; // // public static final long DEFAULT_RESURVEY_DAYS = 90L; // // public static final l...
RegisteredEventsResponse registeredEventsResponse = new RegisteredEventsResponse(registeredEventsList);
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/objects/EndUser.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/utils/Utils.java // public final class Utils { // // private Utils(){} // // public static <T> T checkNotNull(T object, String objectDescription) { // if(object == null) { // throw new IllegalArgumentException(objectDescription + " m...
import android.os.Parcel; import android.os.Parcelable; import com.wootric.androidsdk.utils.Utils; import java.util.HashMap;
this.id = endUser.id; this.email = endUser.email; this.externalId = endUser.externalId; this.phoneNumber = endUser.phoneNumber; this.createdAt = endUser.createdAt; this.properties = endUser.properties; } public EndUser(String email) { this.email = email; ...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/utils/Utils.java // public final class Utils { // // private Utils(){} // // public static <T> T checkNotNull(T object, String objectDescription) { // if(object == null) { // throw new IllegalArgumentException(objectDescription + " m...
return Utils.isNotEmpty(externalId);
Wootric/WootricSDK-Android
androidsdk/src/test/java/com/wootric/androidsdk/network/tasks/CreateResponseTaskTest.java
// Path: androidsdk/src/main/java/com/wootric/androidsdk/OfflineDataHandler.java // public class OfflineDataHandler { // // private static final String LOG_TAG = OfflineDataHandler.class.getName(); // // private static final String KEY_ORIGIN_URL = "origin_url"; // private static final String KEY_END_USER...
import com.wootric.androidsdk.OfflineDataHandler; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.robolectric.RobolectricTestRunner; import static org.assertj.core.api.Assertions.assertThat;
package com.wootric.androidsdk.network.tasks; @RunWith(RobolectricTestRunner.class) public class CreateResponseTaskTest { private static final String ACCESS_TOKEN = "accessToken"; private static final String UNIQUE_LINK = "12345qwerty"; private static final String ORIGIN_URL = "com.test.app"; private ...
// Path: androidsdk/src/main/java/com/wootric/androidsdk/OfflineDataHandler.java // public class OfflineDataHandler { // // private static final String LOG_TAG = OfflineDataHandler.class.getName(); // // private static final String KEY_ORIGIN_URL = "origin_url"; // private static final String KEY_END_USER...
@Mock OfflineDataHandler offlineDataHandler;
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/utility/logstream/format/open/DelimitedFactory.java
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // }
import com.google.protobuf.Message; import org.arbeitspferde.groningen.utility.logstream.OutputLogStream; import org.arbeitspferde.groningen.utility.logstream.OutputLogStreamFactory; import javax.annotation.concurrent.ThreadSafe; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream;
package org.arbeitspferde.groningen.utility.logstream.format.open; /** * <p>{@link DelimitedFactory} furnishes {@link OutputLogStream}s that use use Protocol Buffers' * underlying delimited encoding per {@link Message#writeDelimitedTo(OutputStream)}. * </p> * * {@inheritDoc} */ @ThreadSafe public class Delim...
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/for...
public OutputLogStream forStream(final OutputStream stream) throws IOException {
sladeware/groningen
src/test/java/org/arbeitspferde/groningen/config/ProtoBufBinaryFileSourceTest.java
// Path: src/main/java/org/arbeitspferde/groningen/config/open/NullLegacyProgramConfigurationMediator.java // @Singleton // public class NullLegacyProgramConfigurationMediator implements LegacyProgramConfigurationMediator { // @Override // public String migrateLegacyConfiguration(final String legacyConfiguration) {...
import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import org.arbeitspferde.groningen.Helper; import org.arbeitspferde.groningen.LocalFileFactory; import org.arbeitspferde.groningen.NullFileEventNotifierFactory; import org.arbeitspferde.groningen.config.open.NullLegacyProgramConfiguratio...
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/config/open/NullLegacyProgramConfigurationMediator.java // @Singleton // public class NullLegacyProgramConfigurationMediator implements LegacyProgramConfigurationMediator { // @Override // public String migrateLegacyConfiguration(final String legacyConfiguration) {...
fakeFileEventNotifier, new NullLegacyProgramConfigurationMediator());
sladeware/groningen
src/test/java/org/arbeitspferde/groningen/historydatastore/MemoryHistoryDatastoreTest.java
// Path: src/main/java/org/arbeitspferde/groningen/HistoryDatastore.java // public interface HistoryDatastore { // /** // * Base exception class for all HistoryDatastoreException-related exceptions. This exception // * was intentionally made a checked one, because nearly any datastore operation may fail and /...
import org.arbeitspferde.groningen.HistoryDatastore;
package org.arbeitspferde.groningen.historydatastore; /** * Test for {@link MemoryHistoryDatastore}. */ public class MemoryHistoryDatastoreTest extends HistoryDatastoreTestCase { @Override
// Path: src/main/java/org/arbeitspferde/groningen/HistoryDatastore.java // public interface HistoryDatastore { // /** // * Base exception class for all HistoryDatastoreException-related exceptions. This exception // * was intentionally made a checked one, because nearly any datastore operation may fail and /...
protected HistoryDatastore createHistoryDatastore() {
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/scorer/GenerationNumberWeightedBestPerformerScorer.java
// Path: src/main/java/org/arbeitspferde/groningen/common/EvaluatedSubject.java // public class EvaluatedSubject implements Comparable<EvaluatedSubject> { // private static final long EXPERIMENT_ID_UNINITIALIZED = 0; // private final SubjectStateBridge bridge; // private final Clock clock; // private Instant ti...
import com.google.common.annotations.VisibleForTesting; import com.google.inject.Inject; import org.arbeitspferde.groningen.common.EvaluatedSubject; import org.arbeitspferde.groningen.utility.Clock; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.ut...
package org.arbeitspferde.groningen.scorer; /** * HistoricalBestPerformerScorer that uses the generation number as a major weight in scoring. * * The individual's score for this iteration will be weighted (multiplied) by the iteration * number. * * The best performer scoring will combine individuals both with...
// Path: src/main/java/org/arbeitspferde/groningen/common/EvaluatedSubject.java // public class EvaluatedSubject implements Comparable<EvaluatedSubject> { // private static final long EXPERIMENT_ID_UNINITIALIZED = 0; // private final SubjectStateBridge bridge; // private final Clock clock; // private Instant ti...
List<EvaluatedSubject> alltimeEvaluatedSubjects = new ArrayList<>();
sladeware/groningen
src/test/java/org/arbeitspferde/groningen/ServicesModuleTest.java
// Path: src/main/java/org/arbeitspferde/groningen/open/OpenModule.java // public class OpenModule extends AbstractModule { // private static final Logger log = Logger.getLogger(OpenModule.class.getCanonicalName()); // // @Override // protected void configure() { // log.info("Binding open injectables."); // ...
import com.google.inject.Guice; import com.google.inject.Injector; import org.arbeitspferde.groningen.eventlog.EventLoggerService; import org.arbeitspferde.groningen.open.OpenModule; import junit.framework.TestCase;
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/open/OpenModule.java // public class OpenModule extends AbstractModule { // private static final Logger log = Logger.getLogger(OpenModule.class.getCanonicalName()); // // @Override // protected void configure() { // log.info("Binding open injectables."); // ...
new ServicesModule(), new OpenModule());
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/subject/SubjectGroup.java
// Path: src/main/java/org/arbeitspferde/groningen/config/GroningenConfig.java // public interface SubjectGroupConfig { // // /** // * Returns the {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a child. // * // * @return {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a ...
import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.collect.Lists; import com.google.inject.Inject; import org.arbeitspferde.groningen.config.GroningenConfig.SubjectGroupConfig; import org.arbeitspferde.groningen.config.NamedConfigParam; import org.arbeitspferde.groning...
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/config/GroningenConfig.java // public interface SubjectGroupConfig { // // /** // * Returns the {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a child. // * // * @return {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a ...
private final SubjectGroupConfig config;
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/subject/SubjectGroup.java
// Path: src/main/java/org/arbeitspferde/groningen/config/GroningenConfig.java // public interface SubjectGroupConfig { // // /** // * Returns the {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a child. // * // * @return {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a ...
import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.collect.Lists; import com.google.inject.Inject; import org.arbeitspferde.groningen.config.GroningenConfig.SubjectGroupConfig; import org.arbeitspferde.groningen.config.NamedConfigParam; import org.arbeitspferde.groning...
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/config/GroningenConfig.java // public interface SubjectGroupConfig { // // /** // * Returns the {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a child. // * // * @return {@link ClusterConfig} of which this {@link SubjectGroupConfig} is a ...
throws PermanentFailure, TemporaryFailure {
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/eventlog/SafeProtoLogger.java
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // }
import com.google.common.base.Preconditions; import com.google.protobuf.GeneratedMessage; import org.arbeitspferde.groningen.utility.logstream.OutputLogStream; import javax.annotation.concurrent.ThreadSafe; import java.io.Flushable; import java.io.IOException; import java.util.concurrent.atomic.AtomicLong; import java....
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // Path: src/main/java/org/arbeitspferde/groningen/eventlog/SafeProtoLog...
private final OutputLogStream stream;
sladeware/groningen
src/test/java/org/arbeitspferde/groningen/eventlog/SafeProtoLoggerTest.java
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // }
import com.google.protobuf.Message; import org.arbeitspferde.groningen.proto.Event; import org.arbeitspferde.groningen.utility.logstream.OutputLogStream; import junit.framework.TestCase; import org.easymock.EasyMock;
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // Path: src/test/java/org/arbeitspferde/groningen/eventlog/SafeProtoLog...
private OutputLogStream mockOutputLogStream;
sladeware/groningen
src/test/java/org/arbeitspferde/groningen/datastore/InMemoryDatastoreTest.java
// Path: src/main/java/org/arbeitspferde/groningen/Datastore.java // public interface Datastore { // // /** // * Base exception class for all Datastore-related exceptions. This exception was intentionally // * made a checked one, because nearly any datastore operation may fail and usually we have // * to ...
import org.arbeitspferde.groningen.Datastore;
package org.arbeitspferde.groningen.datastore; /** * Test for {@link InMemoryDatastore}. */ public class InMemoryDatastoreTest extends DatastoreTestCase { @Override
// Path: src/main/java/org/arbeitspferde/groningen/Datastore.java // public interface Datastore { // // /** // * Base exception class for all Datastore-related exceptions. This exception was intentionally // * made a checked one, because nearly any datastore operation may fail and usually we have // * to ...
protected Datastore createDatastore() {
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/eventlog/SafeProtoLoggerFactory.java
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // }
import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; import org.arbeitspferde.groningen.proto.Event; import org.arbeitspferde.groningen.utility.logstream.OutputLogStrea...
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // Path: src/main/java/org/arbeitspferde/groningen/eventlog/SafeProtoLog...
final OutputLogStream stream = outputLogStreamFactory.rotatingStreamForSpecification(
sladeware/groningen
src/test/java/org/arbeitspferde/groningen/eventlog/SafeProtoLoggerFactoryTest.java
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // // Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/f...
import java.io.IOException; import java.io.OutputStream; import java.util.Timer; import java.util.TimerTask; import java.util.logging.Logger; import com.google.inject.Provider; import org.arbeitspferde.groningen.Helper; import org.arbeitspferde.groningen.proto.Event; import org.arbeitspferde.groningen.utility.logstream...
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // // Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/f...
private DelimitedFactory delimitedFactory;
sladeware/groningen
src/test/java/org/arbeitspferde/groningen/eventlog/SafeProtoLoggerFactoryTest.java
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // // Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/f...
import java.io.IOException; import java.io.OutputStream; import java.util.Timer; import java.util.TimerTask; import java.util.logging.Logger; import com.google.inject.Provider; import org.arbeitspferde.groningen.Helper; import org.arbeitspferde.groningen.proto.Event; import org.arbeitspferde.groningen.utility.logstream...
/* Copyright 2012 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/OutputLogStream.java // @NotThreadSafe // public interface OutputLogStream extends Flushable, Closeable { // public void write(final Message message) throws IOException; // } // // Path: src/main/java/org/arbeitspferde/groningen/utility/logstream/f...
public OutputLogStream forStream(final OutputStream stream) throws IOException {
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/PipelineRestorer.java
// Path: src/main/java/org/arbeitspferde/groningen/Datastore.java // class DatastoreException extends Exception { // public DatastoreException() { // super(); // } // // public DatastoreException(final String message) { // super(message); // } // // public DatastoreException(final Throwable ...
import com.google.inject.Inject; import com.google.inject.name.Named; import org.arbeitspferde.groningen.Datastore.DatastoreException; import org.arbeitspferde.groningen.config.DatastoreConfigManager; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger;
package org.arbeitspferde.groningen; /** * PipelineRestorer queries the datastore for the pipelines belonging to the current shard. Then it * starts them via {@link PipelineManager}. */ public class PipelineRestorer { private static final Logger log = Logger.getLogger(PipelineRestorer.class.getCanonicalName())...
// Path: src/main/java/org/arbeitspferde/groningen/Datastore.java // class DatastoreException extends Exception { // public DatastoreException() { // super(); // } // // public DatastoreException(final String message) { // super(message); // } // // public DatastoreException(final Throwable ...
} catch (DatastoreException e) {
sladeware/groningen
src/main/java/org/arbeitspferde/groningen/PipelineRestorer.java
// Path: src/main/java/org/arbeitspferde/groningen/Datastore.java // class DatastoreException extends Exception { // public DatastoreException() { // super(); // } // // public DatastoreException(final String message) { // super(message); // } // // public DatastoreException(final Throwable ...
import com.google.inject.Inject; import com.google.inject.name.Named; import org.arbeitspferde.groningen.Datastore.DatastoreException; import org.arbeitspferde.groningen.config.DatastoreConfigManager; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger;
} public void restorePipelines() { List<PipelineId> currentShardIds = new ArrayList<>(); List<PipelineId> allPipelinesIds; try { allPipelinesIds = dataStore.listPipelinesIds(); } catch (DatastoreException e) { log.log(Level.SEVERE, "can't list pipelines in datastore: " + e.getMessage(),...
// Path: src/main/java/org/arbeitspferde/groningen/Datastore.java // class DatastoreException extends Exception { // public DatastoreException() { // super(); // } // // public DatastoreException(final String message) { // super(message); // } // // public DatastoreException(final Throwable ...
new DatastoreConfigManager(dataStore, state.pipelineId()), false);
sitepoint/Editize
src/com/editize/editorkit/UndoAction.java
// Path: src/com/editize/editorkit/EditizeEditorKit.java // public static class NotifyingUndoManager extends CompoundingUndoManager { // private PropertyChangeSupport pcs; // private boolean active = true; // /** // * NotifyingUndoManager constructor comment. // */ // public NotifyingUndoManager() { // super(); //...
import javax.swing.text.StyledEditorKit; import java.beans.PropertyChangeListener; import com.editize.editorkit.EditizeEditorKit.NotifyingUndoManager; import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent;
package com.editize.editorkit; public class UndoAction extends StyledEditorKit.StyledTextAction implements PropertyChangeListener { protected static final int UNDO = 1; protected static final int REDO = 2; private int type; private javax.swing.undo.UndoManager undoMan;
// Path: src/com/editize/editorkit/EditizeEditorKit.java // public static class NotifyingUndoManager extends CompoundingUndoManager { // private PropertyChangeSupport pcs; // private boolean active = true; // /** // * NotifyingUndoManager constructor comment. // */ // public NotifyingUndoManager() { // super(); //...
public UndoAction(int type, NotifyingUndoManager undoMan)
renaudcerrato/static-maps-api
library/src/main/java/com/mypopsy/maps/StaticMap.java
// Path: library/src/main/java/com/mypopsy/maps/internal/PolyLine.java // final public class PolyLine { // // private PolyLine() {} // // public static String encode(StaticMap.GeoPoint[] points) throws IllegalArgumentException { // StringBuilder sb = new StringBuilder(); // int prevLat = 0, pr...
import com.mypopsy.maps.internal.PolyLine; import com.mypopsy.maps.internal.UrlBuilder; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; import javax.annotation.Nonnull; import javax.annotation.Nullable; impo...
/** * Force http scheme * @return this instance */ public StaticMap http() { this.https = false; return this; } /** * Force https scheme (default) * @return this instance */ public StaticMap https() { this.https = true; return this; ...
// Path: library/src/main/java/com/mypopsy/maps/internal/PolyLine.java // final public class PolyLine { // // private PolyLine() {} // // public static String encode(StaticMap.GeoPoint[] points) throws IllegalArgumentException { // StringBuilder sb = new StringBuilder(); // int prevLat = 0, pr...
UrlBuilder builder = new UrlBuilder(https ? HTTPS : HTTP);
renaudcerrato/static-maps-api
library/src/main/java/com/mypopsy/maps/StaticMap.java
// Path: library/src/main/java/com/mypopsy/maps/internal/PolyLine.java // final public class PolyLine { // // private PolyLine() {} // // public static String encode(StaticMap.GeoPoint[] points) throws IllegalArgumentException { // StringBuilder sb = new StringBuilder(); // int prevLat = 0, pr...
import com.mypopsy.maps.internal.PolyLine; import com.mypopsy.maps.internal.UrlBuilder; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; import javax.annotation.Nonnull; import javax.annotation.Nullable; impo...
* If no size parameter is set, the marker will appear in its default (normal) size. * @see Size * @param size of the marker * @return this instance */ public Builder size(Size size) { this.size = siz...
// Path: library/src/main/java/com/mypopsy/maps/internal/PolyLine.java // final public class PolyLine { // // private PolyLine() {} // // public static String encode(StaticMap.GeoPoint[] points) throws IllegalArgumentException { // StringBuilder sb = new StringBuilder(); // int prevLat = 0, pr...
String path = PolyLine.encode(points);
nikkiii/java-webserver
src/org/nikki/http/fastcgi/FastCGIContentHandler.java
// Path: src/org/nikki/http/content/ContentHandler.java // public interface ContentHandler { // // /** // * Handle a request // * // * @param session // * The session which initiated the request // * @return The response, or null // */ // public void handleRequest(HttpSession session) throws ...
import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.nikki.http.content.ContentHandler; import org.nikki.http.content.HttpResponseException; import org.nikki.http.net.HttpSession;
/** * JavaHttpd, the flexible Java webserver * Copyright (C) 2012 Nikki <nikki@nikkii.us> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your ...
// Path: src/org/nikki/http/content/ContentHandler.java // public interface ContentHandler { // // /** // * Handle a request // * // * @param session // * The session which initiated the request // * @return The response, or null // */ // public void handleRequest(HttpSession session) throws ...
public void handleRequest(HttpSession session) throws HttpResponseException {
nikkiii/java-webserver
src/org/nikki/http/fastcgi/FastCGIContentHandler.java
// Path: src/org/nikki/http/content/ContentHandler.java // public interface ContentHandler { // // /** // * Handle a request // * // * @param session // * The session which initiated the request // * @return The response, or null // */ // public void handleRequest(HttpSession session) throws ...
import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.nikki.http.content.ContentHandler; import org.nikki.http.content.HttpResponseException; import org.nikki.http.net.HttpSession;
/** * JavaHttpd, the flexible Java webserver * Copyright (C) 2012 Nikki <nikki@nikkii.us> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your ...
// Path: src/org/nikki/http/content/ContentHandler.java // public interface ContentHandler { // // /** // * Handle a request // * // * @param session // * The session which initiated the request // * @return The response, or null // */ // public void handleRequest(HttpSession session) throws ...
public void handleRequest(HttpSession session) throws HttpResponseException {
nikkiii/java-webserver
src/org/nikki/http/scgi/SCGIModule.java
// Path: src/org/nikki/http/configuration/ConfigurationNode.java // public class ConfigurationNode { // // /** // * A map of the children of this node // */ // private Map<String, Object> children = new HashMap<String, Object>(); // // /** // * Get an Object value from the map // * // * @param key // ...
import org.nikki.http.configuration.ConfigurationNode; import org.nikki.http.module.ContentModule; import org.nikki.http.module.ModuleLoadingException;
/** * JavaHttpd, the flexible Java webserver * Copyright (C) 2012 Nikki <nikki@nikkii.us> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your ...
// Path: src/org/nikki/http/configuration/ConfigurationNode.java // public class ConfigurationNode { // // /** // * A map of the children of this node // */ // private Map<String, Object> children = new HashMap<String, Object>(); // // /** // * Get an Object value from the map // * // * @param key // ...
public void onLoad(ConfigurationNode node) throws ModuleLoadingException {
nikkiii/java-webserver
src/org/nikki/http/scgi/SCGIModule.java
// Path: src/org/nikki/http/configuration/ConfigurationNode.java // public class ConfigurationNode { // // /** // * A map of the children of this node // */ // private Map<String, Object> children = new HashMap<String, Object>(); // // /** // * Get an Object value from the map // * // * @param key // ...
import org.nikki.http.configuration.ConfigurationNode; import org.nikki.http.module.ContentModule; import org.nikki.http.module.ModuleLoadingException;
/** * JavaHttpd, the flexible Java webserver * Copyright (C) 2012 Nikki <nikki@nikkii.us> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your ...
// Path: src/org/nikki/http/configuration/ConfigurationNode.java // public class ConfigurationNode { // // /** // * A map of the children of this node // */ // private Map<String, Object> children = new HashMap<String, Object>(); // // /** // * Get an Object value from the map // * // * @param key // ...
public void onLoad(ConfigurationNode node) throws ModuleLoadingException {
nikkiii/java-webserver
src/org/nikki/http/fastcgi/net/FastCGIDecoder.java
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
import org.jboss.netty.handler.codec.replay.ReplayingDecoder; import org.nikki.http.fastcgi.FastCGIResponse; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_END_REQUEST; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_REQUEST_COMPLETE; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_STD...
*/ private HashMap<Integer, ChannelBuffer> dataBuffers = new HashMap<Integer, ChannelBuffer>(); /** * Create a new FastCGIDecoder */ public FastCGIDecoder() { super(ResponseState.VERSION); } @Override protected Object decode(ChannelHandlerContext arg0, Channel arg1, ChannelBuffer buffer, ResponseStat...
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
case FCGI_END_REQUEST:
nikkiii/java-webserver
src/org/nikki/http/fastcgi/net/FastCGIDecoder.java
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
import org.jboss.netty.handler.codec.replay.ReplayingDecoder; import org.nikki.http.fastcgi.FastCGIResponse; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_END_REQUEST; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_REQUEST_COMPLETE; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_STD...
} @Override protected Object decode(ChannelHandlerContext arg0, Channel arg1, ChannelBuffer buffer, ResponseState state) throws Exception { switch (state) { case VERSION: version = buffer.readByte(); checkpoint(ResponseState.HEADER); case HEADER: // The types are unsigned in the FCGI docs type ...
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
if (appStatus != 0 || protocolStatus != FCGI_REQUEST_COMPLETE) {
nikkiii/java-webserver
src/org/nikki/http/fastcgi/net/FastCGIDecoder.java
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
import org.jboss.netty.handler.codec.replay.ReplayingDecoder; import org.nikki.http.fastcgi.FastCGIResponse; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_END_REQUEST; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_REQUEST_COMPLETE; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_STD...
case HEADER: // The types are unsigned in the FCGI docs type = buffer.readByte() & 0xFF; id = buffer.readShort() & 0xFFFF; contentLength = buffer.readShort() & 0xFFFF; paddingLength = buffer.readByte() & 0xFFFF; buffer.readByte(); // Reserved byte... logger.finest("Read request header : type=" + ...
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
return new FastCGIResponse(id, dataBuffers.remove(id));
nikkiii/java-webserver
src/org/nikki/http/fastcgi/net/FastCGIDecoder.java
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
import org.jboss.netty.handler.codec.replay.ReplayingDecoder; import org.nikki.http.fastcgi.FastCGIResponse; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_END_REQUEST; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_REQUEST_COMPLETE; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_STD...
contentLength = buffer.readShort() & 0xFFFF; paddingLength = buffer.readByte() & 0xFFFF; buffer.readByte(); // Reserved byte... logger.finest("Read request header : type=" + type + ",id=" + id + ",contentLength=" + contentLength + ",paddingLength=" + paddingLength); checkpoint(ResponseState.CON...
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
case FCGI_STDOUT:
nikkiii/java-webserver
src/org/nikki/http/fastcgi/net/FastCGIDecoder.java
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
import org.jboss.netty.handler.codec.replay.ReplayingDecoder; import org.nikki.http.fastcgi.FastCGIResponse; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_END_REQUEST; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_REQUEST_COMPLETE; import static org.nikki.http.fastcgi.FastCGIConstants.FCGI_STD...
if (appStatus != 0 || protocolStatus != FCGI_REQUEST_COMPLETE) { // Uh oh, when we run a pool of connections we should close // this one here... logger.warning("Protocol status " + protocolStatus); } else if (protocolStatus == FCGI_REQUEST_COMPLETE) { // Reset the version checkpoint(Res...
// Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_END_REQUEST = 3; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_REQUEST_COMPLETE = 0; // // Path: src/org/nikki/http/fastcgi/FastCGIConstants.java // public static final int FCGI_STD...
case FCGI_STDERR:
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/WarehouseProductDAO.java
// Path: src/main/java/com/storage/mywarehouse/View/WarehouseProduct.java // public class WarehouseProduct implements java.io.Serializable { // // // private int id; // private int productId; // private String brand; // private String type; // private int quantity; // private double pri...
import com.storage.mywarehouse.View.WarehouseProduct; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Restrictions; import java.util.List;
package com.storage.mywarehouse.Dao; public class WarehouseProductDAO { @SuppressWarnings("unchecked")
// Path: src/main/java/com/storage/mywarehouse/View/WarehouseProduct.java // public class WarehouseProduct implements java.io.Serializable { // // // private int id; // private int productId; // private String brand; // private String type; // private int quantity; // private double pri...
public static List<WarehouseProduct> findById(int id) {
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/clientForm.java
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
import com.storage.mywarehouse.Entity.Customer; import java.awt.Component; import javax.swing.JOptionPane; import com.storage.mywarehouse.Dao.CustomerDAO;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.storage.mywarehouse; /** * * @author Patroklos */ public class clientForm extends javax.swing.JFrame { private f...
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
private Customer customer;
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/clientForm.java
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
import com.storage.mywarehouse.Entity.Customer; import java.awt.Component; import javax.swing.JOptionPane; import com.storage.mywarehouse.Dao.CustomerDAO;
if (city.getText().length() > 0) { cCity += city.getText(); } if (telephone.getText().length() > 0) { cTelephone += telephone.getText(); } if (clientName.getText().length() > 0) { cName += clientName.getText(); } if (clientJob.g...
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
CustomerDAO.update(customer);
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/Dao/QuantityHistoryViewDAOTest.java
// Path: src/main/java/com/storage/mywarehouse/View/QuantityHistoryView.java // public class QuantityHistoryView implements java.io.Serializable { // // // private int id; // private String warehouse; // private String brand; // private String type; // private int quantity; // private D...
import com.storage.mywarehouse.View.QuantityHistoryView; import org.hibernate.Session; import org.hibernate.criterion.Order; import org.junit.Assert; import org.junit.jupiter.api.Test; import java.util.List; import static org.junit.jupiter.api.Assertions.*;
package com.storage.mywarehouse.Dao; class QuantityHistoryViewDAOTest { @Test void findAll() { Session session = NewHibernateUtil.getSessionFactory().openSession();
// Path: src/main/java/com/storage/mywarehouse/View/QuantityHistoryView.java // public class QuantityHistoryView implements java.io.Serializable { // // // private int id; // private String warehouse; // private String brand; // private String type; // private int quantity; // private D...
List q_history = session.createCriteria(QuantityHistoryView.class)
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/ClientFrame.java
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
import com.storage.mywarehouse.Dao.CustomerDAO; import com.storage.mywarehouse.Entity.Customer; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel;
this.frame = frame; initComponents(); tbmodel = new DefaultTableModel(new Object[]{"Last Name", "First Name", "Occupation", "Discount"}, 0) { @Override public boolean isCellEditable(int row, int column) { return false; } }; j...
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
Customer customer = (Customer) it.next();
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/ClientFrame.java
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
import com.storage.mywarehouse.Dao.CustomerDAO; import com.storage.mywarehouse.Entity.Customer; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel;
getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVe...
// Path: src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java // public class CustomerDAO { // @SuppressWarnings("unchecked") // public static List<Customer> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction tx = session.beginTransaction();...
CustomerDAO.delete(c);
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/Dao/EntryDaoTest.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertAll; import com.storage.mywarehouse.Entity.Warehouse; import com.storage.mywarehouse.Entity.Product; import com.storage.mywarehouse.Entity.Entry; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.j...
package com.storage.mywarehouse.Dao; public class EntryDaoTest { private static final int ZERO = 0; private static final int ONE = 1; private static final int TWO = 2; private static final int THREE = 3; private static final int NINE = 9; private static final String ANY = "ANY"; private...
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
private Warehouse w1;
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/Dao/EntryDaoTest.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertAll; import com.storage.mywarehouse.Entity.Warehouse; import com.storage.mywarehouse.Entity.Product; import com.storage.mywarehouse.Entity.Entry; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.j...
package com.storage.mywarehouse.Dao; public class EntryDaoTest { private static final int ZERO = 0; private static final int ONE = 1; private static final int TWO = 2; private static final int THREE = 3; private static final int NINE = 9; private static final String ANY = "ANY"; private...
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
private Product p1;
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/Dao/EntryDaoTest.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertAll; import com.storage.mywarehouse.Entity.Warehouse; import com.storage.mywarehouse.Entity.Product; import com.storage.mywarehouse.Entity.Entry; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.j...
package com.storage.mywarehouse.Dao; public class EntryDaoTest { private static final int ZERO = 0; private static final int ONE = 1; private static final int TWO = 2; private static final int THREE = 3; private static final int NINE = 9; private static final String ANY = "ANY"; private...
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
private Entry e1;
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/Dao/ProductDaoTest.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Product.java // public class Product implements java.io.Serializable { // // private static final long serialVersionUID = 1L; // // private int productId; // private String brand; // private String type; // private String description; // private double price...
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertAll; import com.storage.mywarehouse.Entity.Product; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterEach;
package com.storage.mywarehouse.Dao; public class ProductDaoTest { private static final int ZERO = 0; private static final int ONE = 1; private static final int TWO = 2; private static final String ANY = "ANY"; private static final String ANY2 = "ANY2"; private static final doub...
// Path: src/main/java/com/storage/mywarehouse/Entity/Product.java // public class Product implements java.io.Serializable { // // private static final long serialVersionUID = 1L; // // private int productId; // private String brand; // private String type; // private String description; // private double price...
private Product sut1;
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/Dao/CustomerDaoTest.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Customer.java // public class Customer implements java.io.Serializable { // // // private int customerId; // private String name; // private String lastName; // private String occupation; // private double discount; // private String...
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertAll; import com.storage.mywarehouse.Entity.Customer; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterEach;
package com.storage.mywarehouse.Dao; public class CustomerDaoTest { private static final int ZERO = 0; private static final int ONE = 1; private static final int TWO = 2; private static final String ANY = "ANY"; private static final String ANY2 = "ANY2"; private static final double DOUBLE_...
// Path: src/main/java/com/storage/mywarehouse/Entity/Customer.java // public class Customer implements java.io.Serializable { // // // private int customerId; // private String name; // private String lastName; // private String occupation; // private double discount; // private String...
private Customer sut1;
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/CustomerDAO.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Customer.java // public class Customer implements java.io.Serializable { // // // private int customerId; // private String name; // private String lastName; // private String occupation; // private double discount; // private String...
import com.storage.mywarehouse.Entity.Customer; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Order; import java.util.List;
package com.storage.mywarehouse.Dao; public class CustomerDAO { @SuppressWarnings("unchecked")
// Path: src/main/java/com/storage/mywarehouse/Entity/Customer.java // public class Customer implements java.io.Serializable { // // // private int customerId; // private String name; // private String lastName; // private String occupation; // private double discount; // private String...
public static List<Customer> findAll() {
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/UtilsImportProductsFromCsvTest.java
// Path: src/main/java/com/storage/mywarehouse/Dao/ProductDAO.java // public class ProductDAO { // // @SuppressWarnings("unchecked") // public static List<Product> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction transaction = session.beginTran...
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; import java.io.File; import java.io.IOException; import java.util.List; import com.storage.mywarehouse.Dao.ProductDAO; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupit...
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.storage.mywarehouse; /** * * @author veruz */ public class UtilsImportProductsFromCsvTest { private File file = ...
// Path: src/main/java/com/storage/mywarehouse/Dao/ProductDAO.java // public class ProductDAO { // // @SuppressWarnings("unchecked") // public static List<Product> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction transaction = session.beginTran...
List<Product> products = ProductDAO.findAllByBrandAndTypeStartLike("unit", "test");
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/UtilsImportProductsFromCsvTest.java
// Path: src/main/java/com/storage/mywarehouse/Dao/ProductDAO.java // public class ProductDAO { // // @SuppressWarnings("unchecked") // public static List<Product> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction transaction = session.beginTran...
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; import java.io.File; import java.io.IOException; import java.util.List; import com.storage.mywarehouse.Dao.ProductDAO; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupit...
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.storage.mywarehouse; /** * * @author veruz */ public class UtilsImportProductsFromCsvTest { private File file = ...
// Path: src/main/java/com/storage/mywarehouse/Dao/ProductDAO.java // public class ProductDAO { // // @SuppressWarnings("unchecked") // public static List<Product> findAll() { // Session session = NewHibernateUtil.getSessionFactory().openSession(); // Transaction transaction = session.beginTran...
List<Product> products = ProductDAO.findAllByBrandAndTypeStartLike("unit", "test");
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/ProductDAO.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Product.java // public class Product implements java.io.Serializable { // // private static final long serialVersionUID = 1L; // // private int productId; // private String brand; // private String type; // private String description; // private double price...
import com.storage.mywarehouse.Entity.Product; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import java.util.List; import static org.hibernate.criterion.Restrictions.and; impor...
package com.storage.mywarehouse.Dao; public class ProductDAO { @SuppressWarnings("unchecked")
// Path: src/main/java/com/storage/mywarehouse/Entity/Product.java // public class Product implements java.io.Serializable { // // private static final long serialVersionUID = 1L; // // private int productId; // private String brand; // private String type; // private String description; // private double price...
public static List<Product> findAll() {
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/EntryDAO.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Entry.java // public class Entry implements java.io.Serializable { // // // private int entryId; // private int warehouseId; // private int productId; // private int quantity; // // public Entry() { // } // // public Entry(int en...
import com.storage.mywarehouse.Entity.Entry; import com.storage.mywarehouse.Entity.Product; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import java.util.List; import static or...
package com.storage.mywarehouse.Dao; public class EntryDAO { @SuppressWarnings("unchecked")
// Path: src/main/java/com/storage/mywarehouse/Entity/Entry.java // public class Entry implements java.io.Serializable { // // // private int entryId; // private int warehouseId; // private int productId; // private int quantity; // // public Entry() { // } // // public Entry(int en...
public static List<Entry> findByWarehouseId(int warehouseId) {
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/QuantityHistoryViewDAO.java
// Path: src/main/java/com/storage/mywarehouse/View/QuantityHistoryView.java // public class QuantityHistoryView implements java.io.Serializable { // // // private int id; // private String warehouse; // private String brand; // private String type; // private int quantity; // private D...
import com.storage.mywarehouse.View.QuantityHistoryView; import org.hibernate.Session; import org.hibernate.criterion.Order; import java.util.List;
package com.storage.mywarehouse.Dao; public class QuantityHistoryViewDAO { @SuppressWarnings("unchecked")
// Path: src/main/java/com/storage/mywarehouse/View/QuantityHistoryView.java // public class QuantityHistoryView implements java.io.Serializable { // // // private int id; // private String warehouse; // private String brand; // private String type; // private int quantity; // private D...
public static List<QuantityHistoryView> findAll() {
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/WarehouseEntryDAO.java
// Path: src/main/java/com/storage/mywarehouse/View/WarehouseEntry.java // public class WarehouseEntry implements java.io.Serializable { // // // private int id; // private int productId; // private String brand; // private String type; // private int quantity; // private double price; ...
import com.storage.mywarehouse.View.WarehouseEntry; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Restrictions; import java.util.List;
package com.storage.mywarehouse.Dao; public class WarehouseEntryDAO { @SuppressWarnings("unchecked")
// Path: src/main/java/com/storage/mywarehouse/View/WarehouseEntry.java // public class WarehouseEntry implements java.io.Serializable { // // // private int id; // private int productId; // private String brand; // private String type; // private int quantity; // private double price; ...
public static List<WarehouseEntry> findByWarehouseId(int warehouseId) {
patroklossam/WareHouse
src/test/java/com/storage/mywarehouse/Dao/WarehouseDaoTest.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertAll; import com.storage.mywarehouse.Entity.Warehouse; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterEach;
package com.storage.mywarehouse.Dao; public class WarehouseDaoTest { private static final int ZERO = 0; private static final int ONE = 1; private static final int TWO = 2; private static final int THREE = 3; private static final String ANY = "ANY"; private static final String ANY2 = "ANY2";...
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
private Warehouse sut1;
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/WarehouseDAO.java
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
import com.storage.mywarehouse.Entity.Warehouse; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Order; import java.util.List; import static org.hibernate.criterion.Restrictions.and; import static org.hibernate.criterion.Restrictions.eq;
package com.storage.mywarehouse.Dao; public class WarehouseDAO { @SuppressWarnings("unchecked")
// Path: src/main/java/com/storage/mywarehouse/Entity/Warehouse.java // public class Warehouse implements java.io.Serializable { // // // private int warehouseId; // private String name; // // public Warehouse() { // } // // public Warehouse(int warehouseId, String name) { // this.ware...
public static List<Warehouse> findAll() {
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/CrfModel.java
// Path: src/main/java/com/asher_stern/crf/crf/filters/CrfFeaturesAndFilters.java // public class CrfFeaturesAndFilters<K, G> implements Serializable // { // private static final long serialVersionUID = 5815029007668803039L; // // public CrfFeaturesAndFilters(FilterFactory<K, G> filterFactory, // CrfFilteredFeat...
import java.io.Serializable; import java.math.BigDecimal; import java.util.ArrayList; import com.asher_stern.crf.crf.filters.CrfFeaturesAndFilters;
package com.asher_stern.crf.crf; /** * This class encapsulates the set of all possible tags, the list of features (f_i), and the list of parameters (\theta_i). * * @author Asher Stern * Date: Nov 8, 2014 * * @param <K> token type - must implement equals() and hashCode() * @param <G> tag type - must implement...
// Path: src/main/java/com/asher_stern/crf/crf/filters/CrfFeaturesAndFilters.java // public class CrfFeaturesAndFilters<K, G> implements Serializable // { // private static final long serialVersionUID = 5815029007668803039L; // // public CrfFeaturesAndFilters(FilterFactory<K, G> filterFactory, // CrfFilteredFeat...
public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> parameters)
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/CrfRememberActiveFeatures.java
// Path: src/main/java/com/asher_stern/crf/crf/filters/CrfFeaturesAndFilters.java // public class CrfFeaturesAndFilters<K, G> implements Serializable // { // private static final long serialVersionUID = 5815029007668803039L; // // public CrfFeaturesAndFilters(FilterFactory<K, G> filterFactory, // CrfFilteredFeat...
import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import com.asher_stern.crf.crf.filters.CrfFeaturesAndFilters;
package com.asher_stern.crf.crf; /** * Holds sets of active features for every token, and every pair of tags (for this token and the preceding token) in the given input. * * @author Asher Stern * Date: Nov 13, 2014 * * @param <K> * @param <G> */ public class CrfRememberActiveFeatures<K, G> { /** * Create...
// Path: src/main/java/com/asher_stern/crf/crf/filters/CrfFeaturesAndFilters.java // public class CrfFeaturesAndFilters<K, G> implements Serializable // { // private static final long serialVersionUID = 5815029007668803039L; // // public CrfFeaturesAndFilters(FilterFactory<K, G> filterFactory, // CrfFilteredFeat...
public static <K, G> CrfRememberActiveFeatures<K, G> findForSentence(CrfFeaturesAndFilters<K, G> features, CrfTags<G> crfTags, K[] sentence)
asher-stern/CRF
src/main/java/com/asher_stern/crf/function/optimization/ConstantLineSearch.java
// Path: src/main/java/com/asher_stern/crf/function/Function.java // public abstract class Function // { // /** // * Returns the f(x) -- the value of the function in the given x. // * @param point the "point" is x -- the input for the function. // * @return the value of f(x) // */ // public abstract BigDecima...
import java.math.BigDecimal; import com.asher_stern.crf.function.Function; import com.asher_stern.crf.utilities.ArithmeticUtilities;
package com.asher_stern.crf.function.optimization; /** * A simple inexact and inaccurate non-efficient line search which merely returns a small * constant for any input. * * @author Asher Stern * Date: Nov 7, 2014 * */ public class ConstantLineSearch<F extends Function> implements LineSearch<F> {
// Path: src/main/java/com/asher_stern/crf/function/Function.java // public abstract class Function // { // /** // * Returns the f(x) -- the value of the function in the given x. // * @param point the "point" is x -- the input for the function. // * @return the value of f(x) // */ // public abstract BigDecima...
public static final BigDecimal DEFAULT_RATE = new BigDecimal(0.01, ArithmeticUtilities.MC);
asher-stern/CRF
src/main/java/com/asher_stern/crf/smalltests/DemoTopK_DS.java
// Path: src/main/java/com/asher_stern/crf/utilities/TopK_DateStructure.java // public class TopK_DateStructure<T> // { // public TopK_DateStructure(int k) // { // this(k, null); // } // // // @SuppressWarnings("unchecked") // public TopK_DateStructure(int k, Comparator<T> comparator) // { // super(); // ...
import java.util.List; import com.asher_stern.crf.utilities.TopK_DateStructure;
package com.asher_stern.crf.smalltests; /** * * @author Asher Stern * Date: Nov 19, 2014 * */ public class DemoTopK_DS { public static void main(String[] args) { try { new DemoTopK_DS().go(); } catch(Throwable t) { t.printStackTrace(System.out); } } public void go() { int k = 3;
// Path: src/main/java/com/asher_stern/crf/utilities/TopK_DateStructure.java // public class TopK_DateStructure<T> // { // public TopK_DateStructure(int k) // { // this(k, null); // } // // // @SuppressWarnings("unchecked") // public TopK_DateStructure(int k, Comparator<T> comparator) // { // super(); // ...
TopK_DateStructure<Integer> ds = new TopK_DateStructure<Integer>(k);
asher-stern/CRF
src/main/java/com/asher_stern/crf/function/optimization/NegatedFunction.java
// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java // public abstract class DerivableFunction extends Function // { // /** // * Returns the gradient of the function in the given point. // * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient ...
import java.math.BigDecimal; import com.asher_stern.crf.function.DerivableFunction; import com.asher_stern.crf.function.Function; import com.asher_stern.crf.function.TwiceDerivableFunction; import com.asher_stern.crf.utilities.CrfException;
package com.asher_stern.crf.function.optimization; /** * Represent "-f(x)" for a given function "f(x)". * <BR> * This negated function can be used when maximization of a function is needed, but a minimization algorithm is available. * Just minimize "-f(x)", and the resulting "x" is the point of the maximum for "...
// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java // public abstract class DerivableFunction extends Function // { // /** // * Returns the gradient of the function in the given point. // * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient ...
public static NegatedFunction fromFunction(Function function)
asher-stern/CRF
src/main/java/com/asher_stern/crf/function/optimization/NegatedFunction.java
// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java // public abstract class DerivableFunction extends Function // { // /** // * Returns the gradient of the function in the given point. // * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient ...
import java.math.BigDecimal; import com.asher_stern.crf.function.DerivableFunction; import com.asher_stern.crf.function.Function; import com.asher_stern.crf.function.TwiceDerivableFunction; import com.asher_stern.crf.utilities.CrfException;
package com.asher_stern.crf.function.optimization; /** * Represent "-f(x)" for a given function "f(x)". * <BR> * This negated function can be used when maximization of a function is needed, but a minimization algorithm is available. * Just minimize "-f(x)", and the resulting "x" is the point of the maximum for "...
// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java // public abstract class DerivableFunction extends Function // { // /** // * Returns the gradient of the function in the given point. // * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient ...
public static NegatedFunction fromDerivableFunction(DerivableFunction derivableFunction)
asher-stern/CRF
src/main/java/com/asher_stern/crf/function/optimization/NegatedFunction.java
// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java // public abstract class DerivableFunction extends Function // { // /** // * Returns the gradient of the function in the given point. // * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient ...
import java.math.BigDecimal; import com.asher_stern.crf.function.DerivableFunction; import com.asher_stern.crf.function.Function; import com.asher_stern.crf.function.TwiceDerivableFunction; import com.asher_stern.crf.utilities.CrfException;
package com.asher_stern.crf.function.optimization; /** * Represent "-f(x)" for a given function "f(x)". * <BR> * This negated function can be used when maximization of a function is needed, but a minimization algorithm is available. * Just minimize "-f(x)", and the resulting "x" is the point of the maximum for "...
// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java // public abstract class DerivableFunction extends Function // { // /** // * Returns the gradient of the function in the given point. // * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient ...
else throw new CrfException("BUG");
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/run/ExampleMain.java
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Arrays; import java.util.List; import java.util.Set; import com.asher_stern.crf.crf.CrfModel; import com.asher_stern.crf...
package com.asher_stern.crf.crf.run; /** * An example for usage of CRF. Don't run this class, but use it as a template for writing your own main class. * * @author Asher Stern * Date: Nov 23, 2014 * */ public class ExampleMain { @SuppressWarnings("unchecked") public static void main(String[] args) { //...
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
List<List<? extends TaggedToken<String, String> >> corpus = loadCorpusWhereTokensAndTagsAreStrings();
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/run/ExampleMain.java
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Arrays; import java.util.List; import java.util.Set; import com.asher_stern.crf.crf.CrfModel; import com.asher_stern.crf...
package com.asher_stern.crf.crf.run; /** * An example for usage of CRF. Don't run this class, but use it as a template for writing your own main class. * * @author Asher Stern * Date: Nov 23, 2014 * */ public class ExampleMain { @SuppressWarnings("unchecked") public static void main(String[] args) { //...
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
CrfModel<String, String> crfModel = trainer.getLearnedModel();
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/run/ExampleMain.java
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Arrays; import java.util.List; import java.util.Set; import com.asher_stern.crf.crf.CrfModel; import com.asher_stern.crf...
// Later... Load the model from the disk crfModel = (CrfModel<String, String>) load(file); // Create a CrfInferencePerformer, to find tags for test data CrfInferencePerformer<String, String> inferencePerformer = new CrfInferencePerformer<String, String>(crfModel); // Test: List<String> test = Arrays.a...
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
public static FilterFactory<String, String> createFilterFactory()
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/features/CaseInsensitiveTokenAndTagFeature.java
// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java // public static <T> boolean equalObjects(T t1, T t2) // { // if (t1==t2) return true; // if ( (t1==null) || (t2==null) ) return false; // return t1.equals(t2); // } // // Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java // ...
import static com.asher_stern.crf.utilities.MiscellaneousUtilities.equalObjects; import com.asher_stern.crf.crf.CrfFeature;
package com.asher_stern.crf.postagging.postaggers.crf.features; /** * A CRF feature the models that a certain token is assigned a certain tag. * The token is considered in a case-insensitivity manner, i.e., "AbC" is considered equal to "abc". * * @author Asher Stern * Date: Nov 20, 2014 * */ public class Cas...
// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java // public static <T> boolean equalObjects(T t1, T t2) // { // if (t1==t2) return true; // if ( (t1==null) || (t2==null) ) return false; // return t1.equals(t2); // } // // Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java // ...
if ( equalObjects(tokenInSentence_lowerCase, tokenLowerCase) && equalObjects(currentTag, tag))
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/evaluation/AccuracyEvaluator.java
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.utilities.CrfException; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.postagging.evaluation; /** * Evaluates the accuracy of a given {@link PosTagger} on a given test corpus. * * @author Asher Stern * Date: Nov 4, 2014 * */ public class AccuracyEvaluator {
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
public AccuracyEvaluator(Iterable<? extends List<? extends TaggedToken<String, String>>> corpus, PosTagger posTagger)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/evaluation/AccuracyEvaluator.java
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.utilities.CrfException; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.postagging.evaluation; /** * Evaluates the accuracy of a given {@link PosTagger} on a given test corpus. * * @author Asher Stern * Date: Nov 4, 2014 * */ public class AccuracyEvaluator {
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
public AccuracyEvaluator(Iterable<? extends List<? extends TaggedToken<String, String>>> corpus, PosTagger posTagger)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/evaluation/AccuracyEvaluator.java
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.utilities.CrfException; import com.asher_stern.crf.utilities.TaggedToken;
/** * Returns how many tags were incorrectly annotated by the {@link PosTagger}. * @return */ public long getIncorrect() { return incorrect; } /** * Returns the accuracy over tag-annotations in the given corpus of the {@link PosTagger}. * @return */ public double getAccuracy() { return accurac...
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
if (!(equals(original.getToken(),byPosTagger.getToken()))) {throw new CrfException("Tokens not equal in evaluation.");}
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/data/TrainTestPosTagCorpus.java
// Path: src/main/java/com/asher_stern/crf/utilities/TaggedToken.java // public class TaggedToken<K,G> // { // public TaggedToken(K token, G tag) // { // super(); // this.token = token; // this.tag = tag; // } // // // // public K getToken() // { // return token; // } // public G getTag() // { // ...
import java.util.Iterator; import java.util.List; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.postagging.data; /** * Splits a given corpus into a train corpus and a test corpus. * <P> * If train-size is provided, and is larger than zero, then the first "train-size" sentences are returned as the train corpus. * Otherwise, the whole corpus is provided as the train corpus. * <P>...
// Path: src/main/java/com/asher_stern/crf/utilities/TaggedToken.java // public class TaggedToken<K,G> // { // public TaggedToken(K token, G tag) // { // super(); // this.token = token; // this.tag = tag; // } // // // // public K getToken() // { // return token; // } // public G getTag() // { // ...
public TrainTestPosTagCorpus(int trainSize, Iterable<List<TaggedToken<K, G>>> realCorpus)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/features/TokenAndTagFeature.java
// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java // public static <T> boolean equalObjects(T t1, T t2) // { // if (t1==t2) return true; // if ( (t1==null) || (t2==null) ) return false; // return t1.equals(t2); // } // // Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java // ...
import static com.asher_stern.crf.utilities.MiscellaneousUtilities.equalObjects; import com.asher_stern.crf.crf.CrfFeature;
package com.asher_stern.crf.postagging.postaggers.crf.features; /** * A feature that models that the given token is assigned the given tag. Tokens are considered case-sensitive, i.e., * "AbC" is <B>NOT</B> equal to "abc". * <BR> * In practice, this feature is not used. Rather {@link CaseInsensitiveTokenAndTagFe...
// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java // public static <T> boolean equalObjects(T t1, T t2) // { // if (t1==t2) return true; // if ( (t1==null) || (t2==null) ) return false; // return t1.equals(t2); // } // // Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java // ...
if (equalObjects(sequence[indexInSequence],forToken) && equalObjects(currentTag,forTag))
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/CrfPosTagger.java
// Path: src/main/java/com/asher_stern/crf/crf/run/CrfInferencePerformer.java // public class CrfInferencePerformer<K, G> // { // public CrfInferencePerformer(CrfModel<K, G> model) // { // super(); // this.model = model; // } // // /** // * Finds the most likely sequence of tags for the given sequence of tok...
import java.util.List; import com.asher_stern.crf.crf.run.CrfInferencePerformer; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.postagging.postaggers.crf; /** * A part-of-speech tagger which assigns the tags using CRF inference. CRF is an acronym of Conditional Random Fields. * * @author Asher Stern * Date: Nov 10, 2014 * */ public class CrfPosTagger implements PosTagger {
// Path: src/main/java/com/asher_stern/crf/crf/run/CrfInferencePerformer.java // public class CrfInferencePerformer<K, G> // { // public CrfInferencePerformer(CrfModel<K, G> model) // { // super(); // this.model = model; // } // // /** // * Finds the most likely sequence of tags for the given sequence of tok...
public CrfPosTagger(CrfInferencePerformer<String, String> inferencePerformer)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/CrfPosTagger.java
// Path: src/main/java/com/asher_stern/crf/crf/run/CrfInferencePerformer.java // public class CrfInferencePerformer<K, G> // { // public CrfInferencePerformer(CrfModel<K, G> model) // { // super(); // this.model = model; // } // // /** // * Finds the most likely sequence of tags for the given sequence of tok...
import java.util.List; import com.asher_stern.crf.crf.run.CrfInferencePerformer; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.postagging.postaggers.crf; /** * A part-of-speech tagger which assigns the tags using CRF inference. CRF is an acronym of Conditional Random Fields. * * @author Asher Stern * Date: Nov 10, 2014 * */ public class CrfPosTagger implements PosTagger { public CrfPosTagger(CrfInferenceP...
// Path: src/main/java/com/asher_stern/crf/crf/run/CrfInferencePerformer.java // public class CrfInferencePerformer<K, G> // { // public CrfInferencePerformer(CrfModel<K, G> model) // { // super(); // this.model = model; // } // // /** // * Finds the most likely sequence of tags for the given sequence of tok...
public List<TaggedToken<String,String>> tagSentence(List<String> sentence)
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/CrfInferenceViterbi.java
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
import java.lang.reflect.Array; import java.math.BigDecimal; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import com.asher_stern.crf.utilities.CrfException; import static com.asher_stern.crf.utilities.ArithmeticUtilities.*;
if (index>0) { valueByPrevious = safeMultiply(valueByPrevious, delta_viterbiForward[index-1].get(tagOfPrevious)); } boolean maxSoFarDetected = false; if (null==maxValueByPrevious) {maxSoFarDetected=true;} else if (maxValueByPrevious.compareTo(valueByPrevious) < 0) {maxSoFarDetected=...
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
if (bestTagCurrentIndex!=null) {throw new CrfException("BUG");} // the tag of "before the first token" must be null.
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/run/CrfFeatureGenerator.java
// Path: src/main/java/com/asher_stern/crf/crf/filters/CrfFilteredFeature.java // public class CrfFilteredFeature<K, G> implements Serializable // { // private static final long serialVersionUID = -5835863638916635217L; // // public CrfFilteredFeature(CrfFeature<K, G> feature, Filter<K, G> filter, boolean whenNotFi...
import java.util.List; import java.util.Set; import com.asher_stern.crf.crf.filters.CrfFilteredFeature; import com.asher_stern.crf.postagging.postaggers.crf.CrfPosTagger; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.crf.run; /** * Generates set of features to be used by the CRF algorithm for training and inference of {@link CrfPosTagger}. * * @author Asher Stern * Date: Nov 10, 2014 * */ public abstract class CrfFeatureGenerator<K,G> {
// Path: src/main/java/com/asher_stern/crf/crf/filters/CrfFilteredFeature.java // public class CrfFilteredFeature<K, G> implements Serializable // { // private static final long serialVersionUID = -5835863638916635217L; // // public CrfFilteredFeature(CrfFeature<K, G> feature, Filter<K, G> filter, boolean whenNotFi...
public CrfFeatureGenerator(Iterable<? extends List<? extends TaggedToken<K, G> >> corpus, Set<G> tags)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/CrfPosTaggerLoader.java
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import com.asher_stern.crf.crf.CrfModel; import com.asher_stern.crf.crf.run.CrfInferencePerformer; import com.asher_stern.crf.postagging.postaggers.PosTaggerLoader; import com.asher_stern.crf.utilities.Crf...
package com.asher_stern.crf.postagging.postaggers.crf; /** * Loads a {@link CrfPosTagger} from a model that is stored in a directory in the file-system. * The model was earlier saved in the file-system by {@link CrfPosTaggerTrainer#save(File)}. * * @author Asher Stern * Date: Nov 20, 2014 * */ public class C...
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
if (!directory.exists()) {throw new CrfException("Given directory: "+directory.getAbsolutePath()+" does not exist.");}
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/CrfPosTaggerLoader.java
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import com.asher_stern.crf.crf.CrfModel; import com.asher_stern.crf.crf.run.CrfInferencePerformer; import com.asher_stern.crf.postagging.postaggers.PosTaggerLoader; import com.asher_stern.crf.utilities.Crf...
package com.asher_stern.crf.postagging.postaggers.crf; /** * Loads a {@link CrfPosTagger} from a model that is stored in a directory in the file-system. * The model was earlier saved in the file-system by {@link CrfPosTaggerTrainer#save(File)}. * * @author Asher Stern * Date: Nov 20, 2014 * */ public class C...
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
CrfModel<String, String> model = (CrfModel<String, String>) inputStream.readObject();
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/CrfPosTaggerLoader.java
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import com.asher_stern.crf.crf.CrfModel; import com.asher_stern.crf.crf.run.CrfInferencePerformer; import com.asher_stern.crf.postagging.postaggers.PosTaggerLoader; import com.asher_stern.crf.utilities.Crf...
package com.asher_stern.crf.postagging.postaggers.crf; /** * Loads a {@link CrfPosTagger} from a model that is stored in a directory in the file-system. * The model was earlier saved in the file-system by {@link CrfPosTaggerTrainer#save(File)}. * * @author Asher Stern * Date: Nov 20, 2014 * */ public class C...
// Path: src/main/java/com/asher_stern/crf/crf/CrfModel.java // public class CrfModel<K,G> implements Serializable // K = token, G = tag // { // private static final long serialVersionUID = -5703467522848303660L; // // public CrfModel(CrfTags<G> crfTags, CrfFeaturesAndFilters<K, G> features, ArrayList<BigDecimal> p...
return new CrfPosTagger(new CrfInferencePerformer<String, String>(model));
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/CrfTags.java
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
import java.io.Serializable; import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import com.asher_stern.crf.utilities.CrfException;
for (G tag : canPrecede.keySet()) { Set<G> newSet = new LinkedHashSet<G>(); for (G precede : canPrecede.get(tag)) { if (precede!=null) { newSet.add(precede); } } canPrecedeNonNull.put(tag, newSet); } } private void initPrecedeWhenFirst() { precedeWhenFirst = new LinkedHashM...
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
if (!debug_firstDetected) {throw new CrfException("Error: no tag has null in its can-precede set. This means that no tag can appear as the first tag in a sentence, which is an error.");}
asher-stern/CRF
src/main/java/com/asher_stern/crf/smalltests/DemoPennCorpus.java
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
import java.io.File; import java.util.List; import org.apache.log4j.Level; import com.asher_stern.crf.postagging.data.LimitedSizePosTagCorpusReader; import com.asher_stern.crf.postagging.data.penn.PennCorpus; import com.asher_stern.crf.utilities.TaggedToken; import com.asher_stern.crf.utilities.log4j.Log4jInit;
package com.asher_stern.crf.smalltests; public class DemoPennCorpus { public static void main(String[] args) { try {
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
Log4jInit.init(Level.DEBUG);
asher-stern/CRF
src/main/java/com/asher_stern/crf/smalltests/DemoPennCorpus.java
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
import java.io.File; import java.util.List; import org.apache.log4j.Level; import com.asher_stern.crf.postagging.data.LimitedSizePosTagCorpusReader; import com.asher_stern.crf.postagging.data.penn.PennCorpus; import com.asher_stern.crf.utilities.TaggedToken; import com.asher_stern.crf.utilities.log4j.Log4jInit;
package com.asher_stern.crf.smalltests; public class DemoPennCorpus { public static void main(String[] args) { try { Log4jInit.init(Level.DEBUG); new DemoPennCorpus().go(new File(args[0])); } catch(Throwable t) { t.printStackTrace(System.out); } } public void go(File directory) {
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
PennCorpus corpus = new PennCorpus(directory);
asher-stern/CRF
src/main/java/com/asher_stern/crf/smalltests/DemoPennCorpus.java
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
import java.io.File; import java.util.List; import org.apache.log4j.Level; import com.asher_stern.crf.postagging.data.LimitedSizePosTagCorpusReader; import com.asher_stern.crf.postagging.data.penn.PennCorpus; import com.asher_stern.crf.utilities.TaggedToken; import com.asher_stern.crf.utilities.log4j.Log4jInit;
package com.asher_stern.crf.smalltests; public class DemoPennCorpus { public static void main(String[] args) { try { Log4jInit.init(Level.DEBUG); new DemoPennCorpus().go(new File(args[0])); } catch(Throwable t) { t.printStackTrace(System.out); } } public void go(File directory) { Penn...
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
LimitedSizePosTagCorpusReader<String,String> reader = new LimitedSizePosTagCorpusReader<String,String>(corpus.iterator(),10);
asher-stern/CRF
src/main/java/com/asher_stern/crf/smalltests/DemoPennCorpus.java
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
import java.io.File; import java.util.List; import org.apache.log4j.Level; import com.asher_stern.crf.postagging.data.LimitedSizePosTagCorpusReader; import com.asher_stern.crf.postagging.data.penn.PennCorpus; import com.asher_stern.crf.utilities.TaggedToken; import com.asher_stern.crf.utilities.log4j.Log4jInit;
package com.asher_stern.crf.smalltests; public class DemoPennCorpus { public static void main(String[] args) { try { Log4jInit.init(Level.DEBUG); new DemoPennCorpus().go(new File(args[0])); } catch(Throwable t) { t.printStackTrace(System.out); } } public void go(File directory) { Penn...
// Path: src/main/java/com/asher_stern/crf/postagging/data/LimitedSizePosTagCorpusReader.java // public class LimitedSizePosTagCorpusReader<K,G> implements Iterator<List<TaggedToken<K, G>>> // { // public LimitedSizePosTagCorpusReader(Iterator<List<TaggedToken<K, G>>> realCorpus, int size) // { // super(); // thi...
List<? extends TaggedToken<String, String>> sentence = reader.next();
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/data/penn/PennFileContentsParser.java
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
import java.util.LinkedList; import java.util.List; import java.util.Stack; import com.asher_stern.crf.utilities.CrfException;
{ PennParserTreeNode node = new PennParserTreeNode(activeNodeContent.toString()); if (!activeStack.isEmpty()) { activeStack.peek().addChild(node); } activeStack.push(node); } activeNodeContent = new StringBuilder(); } else if (c==')') { if (activeNodeContent!=null...
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
if (activeNodeContent==null) {throw new CrfException("Malformed PTB file contents.");}
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/features/StandardFilterFactory.java
// Path: src/main/java/com/asher_stern/crf/crf/filters/Filter.java // public abstract class Filter<K,G> implements Serializable // { // private static final long serialVersionUID = 5563671313834518710L; // // public abstract int hashCode(); // public abstract boolean equals(Object obj); // } // // Path: src/main/...
import java.util.LinkedHashSet; import java.util.Set; import com.asher_stern.crf.crf.filters.Filter; import com.asher_stern.crf.crf.filters.FilterFactory; import com.asher_stern.crf.crf.filters.TwoTagsFilter;
package com.asher_stern.crf.postagging.postaggers.crf.features; /** * A {@link FilterFactory} for the features generated by the {@link StandardFeatureGenerator}. * * @author Asher Stern * Date: Nov 11, 2014 * */ public class StandardFilterFactory implements FilterFactory<String, String> { private static fina...
// Path: src/main/java/com/asher_stern/crf/crf/filters/Filter.java // public abstract class Filter<K,G> implements Serializable // { // private static final long serialVersionUID = 5563671313834518710L; // // public abstract int hashCode(); // public abstract boolean equals(Object obj); // } // // Path: src/main/...
public Set<Filter<String, String>> createFilters(String[] sequence, int tokenIndex, String currentTag, String previousTag)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/features/StandardFilterFactory.java
// Path: src/main/java/com/asher_stern/crf/crf/filters/Filter.java // public abstract class Filter<K,G> implements Serializable // { // private static final long serialVersionUID = 5563671313834518710L; // // public abstract int hashCode(); // public abstract boolean equals(Object obj); // } // // Path: src/main/...
import java.util.LinkedHashSet; import java.util.Set; import com.asher_stern.crf.crf.filters.Filter; import com.asher_stern.crf.crf.filters.FilterFactory; import com.asher_stern.crf.crf.filters.TwoTagsFilter;
package com.asher_stern.crf.postagging.postaggers.crf.features; /** * A {@link FilterFactory} for the features generated by the {@link StandardFeatureGenerator}. * * @author Asher Stern * Date: Nov 11, 2014 * */ public class StandardFilterFactory implements FilterFactory<String, String> { private static fina...
// Path: src/main/java/com/asher_stern/crf/crf/filters/Filter.java // public abstract class Filter<K,G> implements Serializable // { // private static final long serialVersionUID = 5563671313834518710L; // // public abstract int hashCode(); // public abstract boolean equals(Object obj); // } // // Path: src/main/...
ret.add(new TwoTagsFilter<String, String>(currentTag, previousTag));
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/majority/MajorityPosTaggerTrainer.java
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
import java.io.File; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.postagging.postaggers.PosTaggerTrainer; import com.asher_stern.crf.utilities...
package com.asher_stern.crf.postagging.postaggers.majority; /** * Trains a {@link MajorityPosTagger} from a given corpus. * For each token the trainer counts how many times each tag was assigned to that token in the corpus. * Then, for each token, the tag that was the most frequent for that token is considered a...
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
public PosTagger getTrainedPosTagger()
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/majority/MajorityPosTaggerTrainer.java
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
import java.io.File; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.postagging.postaggers.PosTaggerTrainer; import com.asher_stern.crf.utilities...
package com.asher_stern.crf.postagging.postaggers.majority; /** * Trains a {@link MajorityPosTagger} from a given corpus. * For each token the trainer counts how many times each tag was assigned to that token in the corpus. * Then, for each token, the tag that was the most frequent for that token is considered a...
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
if (null==posTagger) {throw new CrfException("Not yet trained.");}
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/data/brown/BrownTaggedSentenceReader.java
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import com.asher_stern.crf.utilities.CrfException; import com.asher_stern.crf.utilities.TaggedToken;
TAGS.add("RN"); TAGS.add("RP"); TAGS.add("TL"); TAGS.add("TO"); TAGS.add("UH"); TAGS.add("VB"); TAGS.add("VBD"); TAGS.add("VBG"); TAGS.add("VBN"); TAGS.add("VBZ"); TAGS.add("WDT"); TAGS.add("WP"); // Not in the original list. Add for WP$ which does appear in the original list. //TAGS.add("WP$"...
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
public List<TaggedToken<String,String>> read()
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/data/brown/BrownTaggedSentenceReader.java
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import com.asher_stern.crf.utilities.CrfException; import com.asher_stern.crf.utilities.TaggedToken;
tag = tag.toUpperCase(); if (letterDetected) { int starIndex = tag.indexOf('*'); if (starIndex>=1) { tag = tag.substring(0, starIndex); } int possessiveIndex = tag.indexOf(POSSESSIVE_INDICATOR); if (possessiveIndex>=1) { tag = tag.substring(0, possessiveIndex); } if (IGNORE.con...
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
throw new CrfException("Unrecognized tag in Brown corpus: "+tag+". Original tag: "+originalTag+".\n"
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/crf/features/TagTransitionFeature.java
// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java // public static <T> boolean equalObjects(T t1, T t2) // { // if (t1==t2) return true; // if ( (t1==null) || (t2==null) ) return false; // return t1.equals(t2); // } // // Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java // ...
import static com.asher_stern.crf.utilities.MiscellaneousUtilities.equalObjects; import com.asher_stern.crf.crf.CrfFeature;
package com.asher_stern.crf.postagging.postaggers.crf.features; /** * A feature that models the transition from one tag to another (possibly the same) tag. * * @author Asher Stern * Date: Nov 10, 2014 * */ public class TagTransitionFeature extends CrfFeature<String, String> { private static final long serial...
// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java // public static <T> boolean equalObjects(T t1, T t2) // { // if (t1==t2) return true; // if ( (t1==null) || (t2==null) ) return false; // return t1.equals(t2); // } // // Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java // ...
if ( equalObjects(previousTag, forPreviousTag) && equalObjects(currentTag, forCurrentTag) )
asher-stern/CRF
src/main/java/com/asher_stern/crf/function/optimization/LineSearchUtilities.java
// Path: src/main/java/com/asher_stern/crf/utilities/VectorUtilities.java // public class VectorUtilities // { // /** // * Returns the inner product of the two given vectors. // * @param rowVector // * @param columnVector // * @return // */ // public static BigDecimal product(BigDecimal[] rowVector, BigDeci...
import static com.asher_stern.crf.utilities.VectorUtilities.*; import java.math.BigDecimal; import com.asher_stern.crf.function.DerivableFunction;
package com.asher_stern.crf.function.optimization; /** * A collection of static helper functions, needed for some implementations of {@link LineSearch}. * * @author Asher Stern * Date: Nov 7, 2014 * */ public class LineSearchUtilities { /** * Returns f(x+\alpha*d), where "x" is the given point, "d" is the...
// Path: src/main/java/com/asher_stern/crf/utilities/VectorUtilities.java // public class VectorUtilities // { // /** // * Returns the inner product of the two given vectors. // * @param rowVector // * @param columnVector // * @return // */ // public static BigDecimal product(BigDecimal[] rowVector, BigDeci...
public static BigDecimal valueForAlpha(DerivableFunction function, BigDecimal[] point, BigDecimal[] direction, BigDecimal alpha)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java
// Path: src/main/java/com/asher_stern/crf/utilities/TaggedToken.java // public class TaggedToken<K,G> // { // public TaggedToken(K token, G tag) // { // super(); // this.token = token; // this.tag = tag; // } // // // // public K getToken() // { // return token; // } // public G getTag() // { // ...
import java.util.List; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.postagging.postaggers; /** * Assigns part-of-speech tags for a given sentence. * * @author Asher Stern * Date: Nov 4, 2014 * */ public interface PosTagger { /** * Assigns tags for each token in the given sentence. * @param sentence An input sentence, given as a list of tokens....
// Path: src/main/java/com/asher_stern/crf/utilities/TaggedToken.java // public class TaggedToken<K,G> // { // public TaggedToken(K token, G tag) // { // super(); // this.token = token; // this.tag = tag; // } // // // // public K getToken() // { // return token; // } // public G getTag() // { // ...
public List<TaggedToken<String,String>> tagSentence(List<String> sentence);
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/postaggers/majority/MajorityPosTagger.java
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
import java.util.ArrayList; import java.util.List; import java.util.Map; import com.asher_stern.crf.postagging.postaggers.PosTagger; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.postagging.postaggers.majority; /** * A {@link PosTagger} which assigns for each word the tag that occurs mostly with that word. * For words that were not seen in the training corpus, this pos-tagger assigns that tag that is most frequent in the * training corpus. * @author Asher Ster...
// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/PosTagger.java // public interface PosTagger // { // /** // * Assigns tags for each token in the given sentence. // * @param sentence An input sentence, given as a list of tokens. // * @return The tagged sentence. // */ // public List<TaggedToke...
public List<TaggedToken<String,String>> tagSentence(List<String> sentence)
asher-stern/CRF
src/main/java/com/asher_stern/crf/postagging/data/brown/BrownCorpusReader.java
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
import java.io.BufferedReader; import java.io.File; import java.io.FileFilter; import java.io.FileReader; import java.io.IOException; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import com.asher_stern.crf.utilities.CrfException; im...
{ goToNextFile(); } return ret; } private void goToNextFile() { thereIsNext = false; sentencesIterator = null; boolean stop = false; while (!stop) { File nextFile = getNextFile(); if (nextFile!=null) { createSentenceIterator(nextFile); stop = sentencesIterator.hasNext();...
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java // public class CrfException extends RuntimeException // { // private static final long serialVersionUID = 5414394233000815286L; // // public CrfException() // { // super(); // } // // public CrfException(String message, Throwable cause, //...
if (!sentencesIterator.hasNext()) {throw new CrfException("BUG");}
asher-stern/CRF
src/main/java/com/asher_stern/crf/crf/run/CrfFeatureGeneratorFactory.java
// Path: src/main/java/com/asher_stern/crf/utilities/TaggedToken.java // public class TaggedToken<K,G> // { // public TaggedToken(K token, G tag) // { // super(); // this.token = token; // this.tag = tag; // } // // // // public K getToken() // { // return token; // } // public G getTag() // { // ...
import java.util.List; import java.util.Set; import com.asher_stern.crf.utilities.TaggedToken;
package com.asher_stern.crf.crf.run; /** * A factory which creates a {@link CrfFeatureGenerator}. * * @author Asher Stern * Date: November 2014 * */ public interface CrfFeatureGeneratorFactory<K,G> { /** * Create the {@link CrfFeatureGenerator}. * @param corpus * @param tags * @return */
// Path: src/main/java/com/asher_stern/crf/utilities/TaggedToken.java // public class TaggedToken<K,G> // { // public TaggedToken(K token, G tag) // { // super(); // this.token = token; // this.tag = tag; // } // // // // public K getToken() // { // return token; // } // public G getTag() // { // ...
public CrfFeatureGenerator<K,G> create(Iterable<? extends List<? extends TaggedToken<K, G> >> corpus, Set<G> tags);